function UrlConversionTest::setUp

Same name in other branches
  1. 8.9.x 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 26

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);
}

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