X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/b3d4c199aefd6066c444898eada3c8bb43dc5cb5..refs/pull/806/head:/tests/PublicActionTest.php diff --git a/tests/PublicActionTest.php b/tests/PublicActionTest.php index 6f8590d4b..dadb37e46 100644 --- a/tests/PublicActionTest.php +++ b/tests/PublicActionTest.php @@ -90,4 +90,35 @@ class PublicActionTest extends BrowserKitTest $this->dontSee($page->name); } + public function test_robots_effected_by_public_status() + { + $this->visit('/robots.txt'); + $this->seeText("User-agent: *\nDisallow: /"); + + $this->setSettings(['app-public' => 'true']); + $this->visit('/robots.txt'); + + $this->seeText("User-agent: *\nDisallow:"); + $this->dontSeeText("Disallow: /"); + } + + public function test_robots_effected_by_setting() + { + $this->visit('/robots.txt'); + $this->seeText("User-agent: *\nDisallow: /"); + + config()->set('app.allow_robots', true); + $this->visit('/robots.txt'); + + $this->seeText("User-agent: *\nDisallow:"); + $this->dontSeeText("Disallow: /"); + + // Check config overrides app-public setting + config()->set('app.allow_robots', false); + $this->setSettings(['app-public' => 'true']); + $this->visit('/robots.txt'); + + $this->seeText("User-agent: *\nDisallow: /"); + } + } \ No newline at end of file