Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
22
core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php
vendored
Normal file
22
core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\simpletest\Unit;
|
||||
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
|
||||
/**
|
||||
* This test crashes PHP.
|
||||
*
|
||||
* To avoid accidentally running, it is not in a normal PSR-4 directory, the
|
||||
* file name does not adhere to PSR-4 and an environment variable also needs to
|
||||
* be set for the crash to happen.
|
||||
*/
|
||||
class SimpletestPhpunitRunCommandTestWillDie extends UnitTestCase {
|
||||
|
||||
public function testWillDie() {
|
||||
if (getenv('SimpletestPhpunitRunCommandTestWillDie') === 'fail') {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ class BrowserTestBaseTest extends BrowserTestBase {
|
|||
$this->drupalLogin($account);
|
||||
|
||||
// Visit a Drupal page that requires login.
|
||||
$this->drupalGet('/test-page');
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
|
||||
// Test page contains some text.
|
||||
|
@ -46,7 +46,7 @@ class BrowserTestBaseTest extends BrowserTestBase {
|
|||
*/
|
||||
public function testForm() {
|
||||
// Ensure the proper response code for a _form route.
|
||||
$this->drupalGet('/form-test/object-builder');
|
||||
$this->drupalGet('form-test/object-builder');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
|
||||
// Ensure the form and text field exist.
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\simpletest\Unit\AssertHelperTraitTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\simpletest\Unit;
|
||||
|
||||
use Drupal\Core\Render\Markup;
|
||||
use Drupal\simpletest\AssertHelperTrait;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \Drupal\simpletest\AssertHelperTrait
|
||||
* @group simpletest
|
||||
*/
|
||||
class AssertHelperTraitTest extends UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::castSafeStrings
|
||||
* @dataProvider providerCastSafeStrings
|
||||
*/
|
||||
public function testCastSafeStrings($expected, $value) {
|
||||
$class = new AssertHelperTestClass();
|
||||
$this->assertSame($expected, $class->testMethod($value));
|
||||
}
|
||||
|
||||
public function providerCastSafeStrings() {
|
||||
$safe_string = Markup::create('test safe string');
|
||||
return [
|
||||
['test simple string', 'test simple string'],
|
||||
[['test simple array', 'test simple array'], ['test simple array', 'test simple array']],
|
||||
['test safe string', $safe_string],
|
||||
[['test safe string', 'test safe string'], [$safe_string, $safe_string]],
|
||||
[['test safe string', 'mixed array', 'test safe string'], [$safe_string, 'mixed array', $safe_string]],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
class AssertHelperTestClass {
|
||||
use AssertHelperTrait;
|
||||
|
||||
public function testMethod($value) {
|
||||
return $this->castSafeStrings($value);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\simpletest\Unit\SimpletestPhpunitRunCommandTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\simpletest\Unit;
|
||||
|
||||
use Drupal\Core\DependencyInjection\ContainerBuilder;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
|
||||
/**
|
||||
* Tests simpletest_run_phpunit_tests() handles PHPunit fatals correctly.
|
||||
*
|
||||
* @group simpletest
|
||||
*
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
class SimpletestPhpunitRunCommandTest extends UnitTestCase {
|
||||
|
||||
function testSimpletestPhpUnitRunCommand() {
|
||||
include_once __DIR__ .'/../../fixtures/simpletest_phpunit_run_command_test.php';
|
||||
$app_root = __DIR__ . '/../../../../../..';
|
||||
include_once "$app_root/core/modules/simpletest/simpletest.module";
|
||||
$container = new ContainerBuilder;
|
||||
$container->set('app.root', $app_root);
|
||||
$file_system = $this->prophesize('Drupal\Core\File\FileSystemInterface');
|
||||
$file_system->realpath('public://simpletest')->willReturn(sys_get_temp_dir());
|
||||
$container->set('file_system', $file_system->reveal());
|
||||
\Drupal::setContainer($container);
|
||||
$test_id = basename(tempnam(sys_get_temp_dir(), 'xxx'));
|
||||
foreach (['pass', 'fail'] as $status) {
|
||||
putenv('SimpletestPhpunitRunCommandTestWillDie=' . $status);
|
||||
$ret = simpletest_run_phpunit_tests($test_id, ['Drupal\Tests\simpletest\Unit\SimpletestPhpunitRunCommandTestWillDie']);
|
||||
$this->assertSame($ret[0]['status'], $status);
|
||||
}
|
||||
unlink(simpletest_phpunit_xml_filepath($test_id));
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue