Update to Drupal 8.0.6. For more information, see https://www.drupal.org/drupal-8.0.6-release-notes
This commit is contained in:
parent
4297c64508
commit
b11a755ba8
159 changed files with 2340 additions and 543 deletions
|
@ -58,4 +58,9 @@ class BrowserTestBaseTest extends BrowserTestBase {
|
|||
$this->assertSame('green', $value);
|
||||
}
|
||||
|
||||
public function testError() {
|
||||
$this->setExpectedException('\Exception', 'User notice: foo');
|
||||
$this->drupalGet('test-error');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,8 +7,12 @@
|
|||
|
||||
namespace Drupal\Tests\simpletest\Unit;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use Drupal\Core\Extension\Extension;
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
use Drupal\simpletest\TestDiscovery;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
use org\bovigo\vfs\vfsStream;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \Drupal\simpletest\TestDiscovery
|
||||
|
@ -256,6 +260,130 @@ EOT;
|
|||
$this->assertEmpty($info['description']);
|
||||
}
|
||||
|
||||
protected function setupVfsWithTestClasses() {
|
||||
vfsStream::setup('drupal');
|
||||
|
||||
$test_file = <<<EOF
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Test description
|
||||
* @group example
|
||||
*/
|
||||
class FunctionalExampleTest {}
|
||||
EOF;
|
||||
|
||||
vfsStream::create([
|
||||
'modules' => [
|
||||
'test_module' => [
|
||||
'tests' => [
|
||||
'src' => [
|
||||
'Functional' => [
|
||||
'FunctionalExampleTest.php' => $test_file,
|
||||
'FunctionalExampleTest2.php' => str_replace(['FunctionalExampleTest', '@group example'], ['FunctionalExampleTest2', '@group example2'], $test_file),
|
||||
],
|
||||
'Kernel' => [
|
||||
'KernelExampleTest3.php' => str_replace(['FunctionalExampleTest', '@group example'], ['KernelExampleTest3', '@group example2'], $test_file),
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getTestClasses
|
||||
*/
|
||||
public function testGetTestClasses() {
|
||||
$this->setupVfsWithTestClasses();
|
||||
$class_loader = $this->prophesize(ClassLoader::class);
|
||||
$module_handler = $this->prophesize(ModuleHandlerInterface::class);
|
||||
|
||||
$test_discovery = new TestTestDiscovery('vfs://drupal', $class_loader->reveal(), $module_handler->reveal());
|
||||
|
||||
$extensions = [
|
||||
'test_module' => new Extension('vfs://drupal', 'module', 'modules/test_module/test_module.info.yml'),
|
||||
];
|
||||
$test_discovery->setExtensions($extensions);
|
||||
$result = $test_discovery->getTestClasses();
|
||||
$this->assertCount(2, $result);
|
||||
$this->assertEquals([
|
||||
'example' => [
|
||||
'Drupal\Tests\test_module\Functional\FunctionalExampleTest' => [
|
||||
'name' => 'Drupal\Tests\test_module\Functional\FunctionalExampleTest',
|
||||
'description' => 'Test description',
|
||||
'group' => 'example',
|
||||
'type' => 'PHPUnit-Functional',
|
||||
],
|
||||
],
|
||||
'example2' => [
|
||||
'Drupal\Tests\test_module\Functional\FunctionalExampleTest2' => [
|
||||
'name' => 'Drupal\Tests\test_module\Functional\FunctionalExampleTest2',
|
||||
'description' => 'Test description',
|
||||
'group' => 'example2',
|
||||
'type' => 'PHPUnit-Functional',
|
||||
],
|
||||
'Drupal\Tests\test_module\Kernel\KernelExampleTest3' => [
|
||||
'name' => 'Drupal\Tests\test_module\Kernel\KernelExampleTest3',
|
||||
'description' => 'Test description',
|
||||
'group' => 'example2',
|
||||
'type' => 'PHPUnit-Kernel',
|
||||
],
|
||||
],
|
||||
], $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getTestClasses
|
||||
*/
|
||||
public function testGetTestClassesWithSelectedTypes() {
|
||||
$this->setupVfsWithTestClasses();
|
||||
$class_loader = $this->prophesize(ClassLoader::class);
|
||||
$module_handler = $this->prophesize(ModuleHandlerInterface::class);
|
||||
|
||||
$test_discovery = new TestTestDiscovery('vfs://drupal', $class_loader->reveal(), $module_handler->reveal());
|
||||
|
||||
$extensions = [
|
||||
'test_module' => new Extension('vfs://drupal', 'module', 'modules/test_module/test_module.info.yml'),
|
||||
];
|
||||
$test_discovery->setExtensions($extensions);
|
||||
$result = $test_discovery->getTestClasses(NULL, ['PHPUnit-Kernel']);
|
||||
$this->assertCount(2, $result);
|
||||
$this->assertEquals([
|
||||
'example' => [
|
||||
],
|
||||
'example2' => [
|
||||
'Drupal\Tests\test_module\Kernel\KernelExampleTest3' => [
|
||||
'name' => 'Drupal\Tests\test_module\Kernel\KernelExampleTest3',
|
||||
'description' => 'Test description',
|
||||
'group' => 'example2',
|
||||
'type' => 'PHPUnit-Kernel',
|
||||
],
|
||||
],
|
||||
], $result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class TestTestDiscovery extends TestDiscovery {
|
||||
|
||||
/**
|
||||
* @var \Drupal\Core\Extension\Extension[]
|
||||
*/
|
||||
protected $extensions = [];
|
||||
|
||||
public function setExtensions(array $extensions) {
|
||||
$this->extensions = $extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getExtensions() {
|
||||
return $this->extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getPhpunitTestSuite
|
||||
* @dataProvider providerTestGetPhpunitTestSuite
|
||||
|
|
Reference in a new issue