Mercurial > hg > isophonics-drupal-site
comparison core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\Tests\simpletest\Unit; | 3 namespace Drupal\Tests\simpletest\Unit; |
4 | 4 |
5 use Drupal\Core\Database\Database; | |
5 use Drupal\Core\DependencyInjection\ContainerBuilder; | 6 use Drupal\Core\DependencyInjection\ContainerBuilder; |
6 use Drupal\Core\File\FileSystemInterface; | 7 use Drupal\Core\File\FileSystemInterface; |
7 use PHPUnit\Framework\TestCase; | 8 use PHPUnit\Framework\TestCase; |
8 | 9 |
9 /** | 10 /** |
13 * not static and we need it to be static here. | 14 * not static and we need it to be static here. |
14 * | 15 * |
15 * @group simpletest | 16 * @group simpletest |
16 * | 17 * |
17 * @runTestsInSeparateProcesses | 18 * @runTestsInSeparateProcesses |
19 * @preserveGlobalState disabled | |
18 */ | 20 */ |
19 class SimpletestPhpunitRunCommandTest extends TestCase { | 21 class SimpletestPhpunitRunCommandTest extends TestCase { |
20 | 22 |
21 /** | 23 /** |
22 * Path to the app root. | 24 * Path to the app root. |
83 * @covers ::simpletest_run_phpunit_tests | 85 * @covers ::simpletest_run_phpunit_tests |
84 * | 86 * |
85 * @dataProvider provideStatusCodes | 87 * @dataProvider provideStatusCodes |
86 */ | 88 */ |
87 public function testSimpletestPhpUnitRunCommand($status, $label) { | 89 public function testSimpletestPhpUnitRunCommand($status, $label) { |
90 // Add a default database connection in order for | |
91 // Database::getConnectionInfoAsUrl() to return valid information. | |
92 Database::addConnectionInfo('default', 'default', [ | |
93 'driver' => 'mysql', | |
94 'username' => 'test_user', | |
95 'password' => 'test_pass', | |
96 'host' => 'test_host', | |
97 'database' => 'test_database', | |
98 'port' => 3306, | |
99 'namespace' => 'Drupal\Core\Database\Driver\mysql', | |
100 ] | |
101 ); | |
88 $test_id = basename(tempnam(sys_get_temp_dir(), 'xxx')); | 102 $test_id = basename(tempnam(sys_get_temp_dir(), 'xxx')); |
89 putenv('SimpletestPhpunitRunCommandTestWillDie=' . $status); | 103 putenv('SimpletestPhpunitRunCommandTestWillDie=' . $status); |
90 $ret = simpletest_run_phpunit_tests($test_id, [SimpletestPhpunitRunCommandTestWillDie::class]); | 104 $ret = simpletest_run_phpunit_tests($test_id, [SimpletestPhpunitRunCommandTestWillDie::class]); |
91 $this->assertSame($ret[0]['status'], $label); | 105 $this->assertSame($ret[0]['status'], $label); |
92 putenv('SimpletestPhpunitRunCommandTestWillDie'); | 106 putenv('SimpletestPhpunitRunCommandTestWillDie'); |