]> BookStack Code Mirror - bookstack/blobdiff - tests/PublicActionTest.php
Updated 'Spanish Argentina' translation.
[bookstack] / tests / PublicActionTest.php
index 4e242fc7d6d34e9dadcd670771e326f225a0906f..dadb37e46ce2cac9082d98b05fef2615fee972db 100644 (file)
@@ -1,6 +1,6 @@
-<?php
+<?php namespace Tests;
 
-class PublicActionTest extends TestCase
+class PublicActionTest extends BrowserKitTest
 {
 
     public function test_app_not_public()
@@ -84,10 +84,41 @@ class PublicActionTest extends TestCase
     {
         $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