X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/a6128a1df12cc37a2fd7fce2ecc0e08ba9fb3c91..refs/pull/806/head:/tests/PublicActionTest.php diff --git a/tests/PublicActionTest.php b/tests/PublicActionTest.php index 62a321b5e..dadb37e46 100644 --- a/tests/PublicActionTest.php +++ b/tests/PublicActionTest.php @@ -84,10 +84,41 @@ class PublicActionTest extends BrowserKitTest { $page = \BookStack\Page::first(); $this->asAdmin()->visit($page->getUrl()); - Auth::logout(); + \Auth::logout(); view()->share('pageTitle', ''); $this->forceVisit('/cats/dogs/hippos'); $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