You are here

class SimpletestPhpunitRunCommandTest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php \Drupal\Tests\simpletest\Unit\SimpletestPhpunitRunCommandTest

Tests simpletest_run_phpunit_tests() handles PHPunit fatals correctly.

@group simpletest

@runTestsInSeparateProcesses @preserveGlobalState disabled

Hierarchy

Expanded class hierarchy of SimpletestPhpunitRunCommandTest

File

core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php, line 21
Contains \Drupal\Tests\simpletest\Unit\SimpletestPhpunitRunCommandTest.

Namespace

Drupal\Tests\simpletest\Unit
View source
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));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SimpletestPhpunitRunCommandTest::testSimpletestPhpUnitRunCommand function
UnitTestCase::$randomGenerator protected property The random generator.
UnitTestCase::$root protected property The app root.
UnitTestCase::assertArrayEquals protected function Asserts if two arrays are equal by sorting them first.
UnitTestCase::getBlockMockWithMachineName protected function Mocks a block with a block plugin.
UnitTestCase::getClassResolverStub protected function Returns a stub class resolver.
UnitTestCase::getConfigFactoryStub public function Returns a stub config factory that behaves according to the passed in array.
UnitTestCase::getConfigStorageStub public function Returns a stub config storage that returns the supplied configuration.
UnitTestCase::getContainerWithCacheTagsInvalidator protected function Sets up a container with a cache tags invalidator.
UnitTestCase::getRandomGenerator protected function Gets the random generator for the utility methods.
UnitTestCase::getStringTranslationStub public function Returns a stub translation manager that just returns the passed string.
UnitTestCase::randomMachineName public function Generates a unique random string containing letters and numbers.
UnitTestCase::setUp protected function 259