function TestRunnerKernelTest::testConstructor

@covers ::__construct @dataProvider providerTestConstructor

File

core/tests/Drupal/Tests/Core/Test/TestRunnerKernelTest.php, line 83

Class

TestRunnerKernelTest
@coversDefaultClass \Drupal\Core\Test\TestRunnerKernel @runTestsInSeparateProcesses @preserveGlobalState disabled @group Test @group simpletest

Namespace

Drupal\Tests\Core\Test

Code

public function testConstructor($file_system, $expected) {
    // Set up the file system.
    $vfs = vfsStream::setup('root');
    vfsStream::create($file_system, $vfs);
    $kernel = new TestRunnerKernel('prod', new ClassLoader(), FALSE, vfsStream::url('root'));
    $class = new \ReflectionClass(TestRunnerKernel::class);
    $instance_method = $class->getMethod('moduleData');
    $instance_method->setAccessible(TRUE);
    
    /** @var \Drupal\Core\Extension\Extension $extension */
    $extension = $instance_method->invoke($kernel, 'simpletest');
    if ($expected === FALSE) {
        $this->assertFalse($extension);
    }
    else {
        $this->assertInstanceOf(Extension::class, $extension);
        $this->assertSame($expected, $extension->getPath());
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.