function PathLocatorTest::testWebRoot

Tests that the web root is computed correctly.

@covers ::getWebRoot

@dataProvider providerWebRoot

Parameters

string $app_root: The absolute path of the Drupal root.

string $project_root: The absolute path of the project root.

string $expected_web_root: The value expected from getWebRoot().

File

core/modules/package_manager/tests/src/Unit/PathLocatorTest.php, line 108

Class

PathLocatorTest
@coversDefaultClass \Drupal\package_manager\PathLocator[[api-linebreak]] @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Unit

Code

public function testWebRoot(string $app_root, string $project_root, string $expected_web_root) : void {
  $path_locator = $this->getMockBuilder(PathLocator::class)
    ->onlyMethods([
    'getProjectRoot',
    'getStagingRoot',
    'getVendorDirectory',
  ])
    ->setConstructorArgs([
    $app_root,
    $this->getConfigFactoryStub(),
    $this->prophesize(FileSystemInterface::class)
      ->reveal(),
  ])
    ->getMock();
  $path_locator->method('getProjectRoot')
    ->willReturn($project_root);
  $this->assertSame($expected_web_root, $path_locator->getWebRoot());
}

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