You are here

protected function TestDiscoveryTest::getTestDiscoveryMock in Drupal 8

Same name in this branch
  1. 8 core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php \Drupal\Tests\Core\Test\TestDiscoveryTest::getTestDiscoveryMock()
  2. 8 core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php \Drupal\Tests\simpletest\Unit\TestDiscoveryTest::getTestDiscoveryMock()
Same name and namespace in other branches
  1. 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 419

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(),
  ])
    ->setMethods([
    'getExtensions',
  ])
    ->getMock();
  $test_discovery
    ->expects($this
    ->any())
    ->method('getExtensions')
    ->willReturn($extensions);
  return $test_discovery;
}