You are here

protected function TestDiscoveryTest::getTestDiscoveryMock in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::getTestDiscoveryMock()
  2. 9 core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::getTestDiscoveryMock()

Mock a TestDiscovery object to return specific extension values.

2 calls to TestDiscoveryTest::getTestDiscoveryMock()
TestDiscoveryTest::testGetTestClasses in core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php
@covers ::getTestClasses
TestDiscoveryTest::testGetTestClassesWithSelectedTypes in core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php
@covers ::getTestClasses

File

core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php, line 350

Class

TestDiscoveryTest
@coversDefaultClass \Drupal\Core\Test\TestDiscovery @group Test

Namespace

Drupal\Tests\Core\Test

Code

protected function getTestDiscoveryMock($app_root, $extensions) {
  $class_loader = $this
    ->prophesize(ClassLoader::class);
  $module_handler = $this
    ->prophesize(ModuleHandlerInterface::class);
  $test_discovery = $this
    ->getMockBuilder(TestDiscovery::class)
    ->setConstructorArgs([
    $app_root,
    $class_loader
      ->reveal(),
    $module_handler
      ->reveal(),
  ])
    ->onlyMethods([
    'getExtensions',
  ])
    ->getMock();
  $test_discovery
    ->expects($this
    ->any())
    ->method('getExtensions')
    ->willReturn($extensions);
  return $test_discovery;
}