diff --git a/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/DefaultContentFilesAccessTest.php b/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/DefaultContentFilesAccessTest.php index 646ad3bcfc..924ac4ea8d 100644 --- a/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/DefaultContentFilesAccessTest.php +++ b/core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/DefaultContentFilesAccessTest.php @@ -2,6 +2,7 @@ namespace Drupal\Tests\demo_umami_content\Functional; +use Drupal\Core\Site\Settings; use Drupal\Tests\BrowserTestBase; /** @@ -13,22 +14,23 @@ class DefaultContentFilesAccessTest extends BrowserTestBase { /** * Tests that sample images, recipes and articles are not accessible. - * - * Note the demo_umami profile is not used because we want to ensure that if - * you install another profile these files are not available. */ public function testAccessDeniedToFiles() { - // Hard code the path sonce the demo_umami profile is not installed. - $default_content_path = 'core/profiles/demo_umami/modules/demo_umami_content/default_content/'; + // The demo_umami profile should not used because we want to ensure that if + // you install another profile these files are not available. + $this->assertNotSame('demo_umami', Settings::get('install_profile')); + $files_to_test = [ - $default_content_path . 'images/chocolate-brownie-umami.jpg', - $default_content_path . 'recipe_instructions/chocolate-brownie-umami.html', - $default_content_path . 'article_body/lets-hear-it-for-carrots.html', - $default_content_path . 'articles.csv', + 'images/chocolate-brownie-umami.jpg', + 'recipe_instructions/chocolate-brownie-umami.html', + 'article_body/lets-hear-it-for-carrots.html', + 'articles.csv', ]; foreach ($files_to_test as $file) { - $this->assertFileExists(str_replace('/', DIRECTORY_SEPARATOR, $this->root . '/' . $file)); - $this->drupalGet($file); + // Hard code the path since the demo_umami profile is not installed. + $content_path = "core/profiles/demo_umami/modules/demo_umami_content/default_content/$file"; + $this->assertFileExists($this->root . '/' . $content_path); + $this->drupalGet($content_path); $this->assertSession()->statusCodeEquals(403); } }