You are here

protected function UrlConversionTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php \Drupal\Tests\Core\Database\UrlConversionTest::setUp()
  2. 10 core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php \Drupal\Tests\Core\Database\UrlConversionTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php, line 27

Class

UrlConversionTest
Tests for database URL to/from database connection array conversions.

Namespace

Drupal\Tests\Core\Database

Code

protected function setUp() : void {
  parent::setUp();
  $this->root = dirname(__FILE__, 7);

  // Mock the container so we don't need to mock drupal_valid_test_ua().
  // @see \Drupal\Core\Extension\ExtensionDiscovery::scan()
  $container = $this
    ->createMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
  $container
    ->expects($this
    ->any())
    ->method('has')
    ->with('kernel')
    ->willReturn(TRUE);
  $container
    ->expects($this
    ->any())
    ->method('getParameter')
    ->with('site.path')
    ->willReturn('');
  \Drupal::setContainer($container);
  new Settings([
    'extension_discovery_scan_tests' => TRUE,
  ]);
}