Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes

This commit is contained in:
Pantheon Automation 2016-04-20 09:56:34 -07:00 committed by Greg Anderson
parent b11a755ba8
commit c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\phpunit_test\PhpUnitTestDummyClass.
*/
namespace Drupal\phpunit_test;
class PhpUnitTestDummyClass {

View file

@ -1,5 +1,12 @@
<?php
/**
* @file
* Install hooks for test module.
*/
use Drupal\entity_test\Entity\EntityTest;
/**
* Implements hook_install().
*/
@ -22,6 +29,6 @@ function simpletest_test_install() {
* Callback for batch operations.
*/
function _simpletest_test_callback($id) {
$entity = entity_create('entity_test', array('id' => $id));
$entity = EntityTest::create(array('id' => $id));
$entity->save();
}

View file

@ -1,13 +1,8 @@
<?php
/**
* @file
* Contains \Drupal\Tests\simpletest\Functional\BrowserTestBaseTest.
*/
namespace Drupal\Tests\simpletest\Functional;
use Drupal\simpletest\BrowserTestBase;
use Drupal\Tests\BrowserTestBase;
/**
* Tests BrowserTestBase functionality.

View file

@ -0,0 +1,56 @@
<?php
namespace Drupal\Tests\simpletest\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
/**
* Tests if we can execute JavaScript in the browser.
*
* @group javascript
*/
class BrowserWithJavascriptTest extends JavascriptTestBase {
public function testJavascript() {
$this->drupalGet('<front>');
$session = $this->getSession();
$session->resizeWindow(400, 300);
$javascript = <<<JS
(function(){
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight || e.clientHeight|| g.clientHeight;
return x == 400 && y == 300;
}());
JS;
$this->assertJsCondition($javascript);
}
public function testAssertJsCondition() {
$this->drupalGet('<front>');
$session = $this->getSession();
$session->resizeWindow(500, 300);
$javascript = <<<JS
(function(){
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight || e.clientHeight|| g.clientHeight;
return x == 400 && y == 300;
}());
JS;
// We expected the following assertion to fail because the window has been
// re-sized to have a width of 500 not 400.
$this->setExpectedException(\PHPUnit_Framework_AssertionFailedError::class);
$this->assertJsCondition($javascript, 100);
}
}

View file

@ -0,0 +1,46 @@
<?php
namespace Drupal\Tests\simpletest\Kernel\Migrate\d6;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade variables to simpletest.settings.yml.
*
* @group migrate_drupal_6
*/
class MigrateSimpletestConfigsTest extends MigrateDrupal6TestBase {
use SchemaCheckTestTrait;
/**
* {@inheritdoc}
*/
public static $modules = array('simpletest');
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installConfig(['simpletest']);
$this->executeMigration('d6_simpletest_settings');
}
/**
* Tests migration of simpletest variables to simpletest.settings.yml.
*/
public function testSimpletestSettings() {
$config = $this->config('simpletest.settings');
$this->assertIdentical(TRUE, $config->get('clear_results'));
$this->assertIdentical(CURLAUTH_BASIC, $config->get('httpauth.method'));
// NULL in the dump means defaults which is empty string. Same as omitting
// them.
$this->assertIdentical('', $config->get('httpauth.password'));
$this->assertIdentical('', $config->get('httpauth.username'));
$this->assertIdentical(TRUE, $config->get('verbose'));
$this->assertConfigSchema(\Drupal::service('config.typed'), 'simpletest.settings', $config->get());
}
}

View file

@ -0,0 +1,37 @@
<?php
namespace Drupal\Tests\simpletest\Kernel\Migrate\d7;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
/**
* Tests migration of SimpleTest's variables to configuration.
*
* @group simpletest
*/
class MigrateSimpletestSettingsTest extends MigrateDrupal7TestBase {
public static $modules = ['simpletest'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installConfig(static::$modules);
$this->executeMigration('d7_simpletest_settings');
}
/**
* Tests migration of SimpleTest settings to configuration.
*/
public function testMigration() {
$config = \Drupal::config('simpletest.settings')->get();
$this->assertTrue($config['clear_results']);
$this->assertIdentical(CURLAUTH_BASIC, $config['httpauth']['method']);
$this->assertIdentical('testbot', $config['httpauth']['username']);
$this->assertIdentical('foobaz', $config['httpauth']['password']);
$this->assertTrue($config['verbose']);
}
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\simpletest\Unit\PhpUnitAutoloaderTest.
*/
namespace Drupal\Tests\simpletest\Unit;
use Drupal\Tests\UnitTestCase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\simpletest\Unit\PhpUnitErrorTest.
*/
namespace Drupal\Tests\simpletest\Unit;
use Drupal\Tests\UnitTestCase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\simpletest\Unit\SimpletestPhpunitRunCommandTest.
*/
namespace Drupal\Tests\simpletest\Unit;
use Drupal\Core\DependencyInjection\ContainerBuilder;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\simpletest\Unit\TestBaseTest.
*/
namespace Drupal\Tests\simpletest\Unit;
use Drupal\Tests\UnitTestCase;

View file

@ -5,7 +5,7 @@
* Contains \Drupal\Tests\simpletest\Unit\TestInfoParsingTest.
*/
namespace Drupal\Tests\simpletest\Unit;
namespace Drupal\Tests\simpletest\Unit {
use Composer\Autoload\ClassLoader;
use Drupal\Core\Extension\Extension;
@ -87,18 +87,18 @@ class TestInfoParsingTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\field\Tests\BulkDeleteTest',
'group' => 'field',
'description' => 'Bulk delete storages and fields, and clean up afterwards.',
'name' => 'Drupal\simpletest\Tests\ExampleSimpleTest',
'group' => 'simpletest',
'description' => 'Tests the Simpletest UI internal browser.',
'type' => 'Simpletest',
],
// Classname.
'Drupal\field\Tests\BulkDeleteTest',
'Drupal\simpletest\Tests\ExampleSimpleTest',
// Doc block.
"/**
* Bulk delete storages and fields, and clean up afterwards.
* Tests the Simpletest UI internal browser.
*
* @group field
* @group simpletest
*/
",
];
@ -107,18 +107,19 @@ class TestInfoParsingTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\field\Tests\BulkDeleteTest',
'group' => 'field',
'description' => 'Bulk delete storages and fields, and clean up afterwards.',
'type' => 'Simpletest'
'name' => 'Drupal\simpletest\Tests\ExampleSimpleTest',
'group' => 'simpletest',
'description' => 'Tests the Simpletest UI internal browser.',
'type' => 'Simpletest',
],
// Classname.
'Drupal\field\Tests\BulkDeleteTest',
'Drupal\simpletest\Tests\ExampleSimpleTest',
// Doc block.
"/**
* Bulk delete storages and fields, and clean up afterwards.
* Tests the Simpletest UI internal browser.
*
* @group field
* @group simpletest
*/
*/
",
];
@ -128,18 +129,18 @@ class TestInfoParsingTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\field\Tests\BulkDeleteTest',
'group' => 'field',
'description' => 'Bulk delete storages and fields, and clean up afterwards. * @',
'type' => 'Simpletest'
'name' => 'Drupal\simpletest\Tests\ExampleSimpleTest',
'group' => 'simpletest',
'description' => 'Tests the Simpletest UI internal browser. * @',
'type' => 'Simpletest',
],
// Classname.
'Drupal\field\Tests\BulkDeleteTest',
'Drupal\simpletest\Tests\ExampleSimpleTest',
// Doc block.
"/**
* Bulk delete storages and fields, and clean up afterwards. * @
* Tests the Simpletest UI internal browser. * @
*
* @group field
* @group simpletest
*/
",
];
@ -148,19 +149,19 @@ class TestInfoParsingTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\field\Tests\BulkDeleteTest',
'name' => 'Drupal\simpletest\Tests\ExampleSimpleTest',
'group' => 'Test',
'description' => 'Bulk delete storages and fields, and clean up afterwards.',
'type' => 'Simpletest'
'description' => 'Tests the Simpletest UI internal browser.',
'type' => 'Simpletest',
],
// Classname.
'Drupal\field\Tests\BulkDeleteTest',
'Drupal\simpletest\Tests\ExampleSimpleTest',
// Doc block.
"/**
* Bulk delete storages and fields, and clean up afterwards.
* Tests the Simpletest UI internal browser.
*
* @group Test
* @group field
* @group simpletest
*/
",
];
@ -169,20 +170,20 @@ class TestInfoParsingTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\field\Tests\BulkDeleteTest',
'group' => 'field',
'description' => 'Bulk delete storages and fields, and clean up afterwards.',
'name' => 'Drupal\simpletest\Tests\ExampleSimpleTest',
'description' => 'Tests the Simpletest UI internal browser.',
'type' => 'Simpletest',
'requires' => ['module' => ['test']],
'type' => 'Simpletest'
'group' => 'simpletest',
],
// Classname.
'Drupal\field\Tests\BulkDeleteTest',
'Drupal\simpletest\Tests\ExampleSimpleTest',
// Doc block.
"/**
* Bulk delete storages and fields, and clean up afterwards.
* Tests the Simpletest UI internal browser.
*
* @dependencies test
* @group field
* @group simpletest
*/
",
];
@ -191,20 +192,20 @@ class TestInfoParsingTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\field\Tests\BulkDeleteTest',
'group' => 'field',
'description' => 'Bulk delete storages and fields, and clean up afterwards.',
'name' => 'Drupal\simpletest\Tests\ExampleSimpleTest',
'description' => 'Tests the Simpletest UI internal browser.',
'type' => 'Simpletest',
'requires' => ['module' => ['test', 'test1', 'test2']],
'type' => 'Simpletest'
'group' => 'simpletest',
],
// Classname.
'Drupal\field\Tests\BulkDeleteTest',
'Drupal\simpletest\Tests\ExampleSimpleTest',
// Doc block.
"/**
* Bulk delete storages and fields, and clean up afterwards.
* Tests the Simpletest UI internal browser.
*
* @dependencies test, test1,test2
* @group field
* @dependencies test, test1, test2
* @group simpletest
*/
",
];
@ -213,18 +214,19 @@ class TestInfoParsingTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\field\Tests\BulkDeleteTest',
'group' => 'field',
'description' => 'Bulk delete storages and fields, and clean up afterwards. And the summary line continues and there is no gap to the annotation.',
'type' => 'Simpletest'
'name' => 'Drupal\simpletest\Tests\ExampleSimpleTest',
'description' => 'Tests the Simpletest UI internal browser. And the summary line continues an there is no gap to the annotation.',
'type' => 'Simpletest',
'group' => 'simpletest',
],
// Classname.
'Drupal\field\Tests\BulkDeleteTest',
'Drupal\simpletest\Tests\ExampleSimpleTest',
// Doc block.
"/**
* Bulk delete storages and fields, and clean up afterwards. And the summary
* line continues and there is no gap to the annotation.
* @group field
* Tests the Simpletest UI internal browser. And the summary line continues an
* there is no gap to the annotation.
*
* @group simpletest
*/
",
];
@ -234,10 +236,10 @@ class TestInfoParsingTest extends UnitTestCase {
/**
* @covers ::getTestInfo
* @expectedException \Drupal\simpletest\Exception\MissingGroupException
* @expectedExceptionMessage Missing @group annotation in Drupal\field\Tests\BulkDeleteTest
* @expectedExceptionMessage Missing @group annotation in Drupal\KernelTests\field\BulkDeleteTest
*/
public function testTestInfoParserMissingGroup() {
$classname = 'Drupal\field\Tests\BulkDeleteTest';
$classname = 'Drupal\KernelTests\field\BulkDeleteTest';
$doc_comment = <<<EOT
/**
* Bulk delete storages and fields, and clean up afterwards.
@ -250,7 +252,7 @@ EOT;
* @covers ::getTestInfo
*/
public function testTestInfoParserMissingSummary() {
$classname = 'Drupal\field\Tests\BulkDeleteTest';
$classname = 'Drupal\KernelTests\field\BulkDeleteTest';
$doc_comment = <<<EOT
/**
* @group field
@ -410,3 +412,19 @@ class TestTestDiscovery extends TestDiscovery {
}
}
}
namespace Drupal\simpletest\Tests {
use Drupal\simpletest\WebTestBase;
/**
* Tests the Simpletest UI internal browser.
*
* @group simpletest
*/
class ExampleSimpleTest extends WebTestBase {
}
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\Tests\simpletest\Unit\WebTestBaseTest.
*/
namespace Drupal\Tests\simpletest\Unit;
use Drupal\Tests\UnitTestCase;