diff --git a/core/modules/comment/tests/src/Functional/CommentUserTest.php b/core/modules/comment/tests/src/Functional/CommentUserTest.php index 216ebdf..b43c1a1 100644 --- a/core/modules/comment/tests/src/Functional/CommentUserTest.php +++ b/core/modules/comment/tests/src/Functional/CommentUserTest.php @@ -99,7 +99,7 @@ public function testUserCommenting() { $edit = []; $edit['subject[0][value]'] = 'I can comment on a user?'; $this->submitForm($edit, t('Save')); - $this->assertSession()->addressEquals('/user/' . $this->adminUser->id() . '#comment-1'); + $this->assertSession()->addressEquals($this->basePath . 'user/' . $this->adminUser->id() . '#comment-1'); $this->assertSession()->pageTextContains('Your comment has been posted'); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->pageTextContains('I can comment on a user'); diff --git a/core/modules/simpletest/src/BrowserTestBase.php b/core/modules/simpletest/src/BrowserTestBase.php index e0ece50..e7a8298 100644 --- a/core/modules/simpletest/src/BrowserTestBase.php +++ b/core/modules/simpletest/src/BrowserTestBase.php @@ -181,6 +181,13 @@ protected $customTranslations; /** + * Base path for test environment. + * + * @var string + */ + protected $basePath = '/'; + + /** * Mink session manager. * * @var \Behat\Mink\Mink @@ -234,7 +241,7 @@ protected function setUp() { // Setup $_SERVER variable. $parsed_url = parse_url($base_url); $host = $parsed_url['host'] . (isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''); - $path = isset($parsed_url['path']) ? rtrim(rtrim($parsed_url['path']), '/') : ''; + $path = $this->basePath = isset($parsed_url['path']) ? rtrim(rtrim($parsed_url['path']), '/') : ''; $port = isset($parsed_url['port']) ? $parsed_url['port'] : 80; // If the passed URL schema is 'https' then setup the $_SERVER variables