]> BookStack Code Mirror - bookstack/blob - tests/Meta/RobotsTest.php
ZIP Exports: Changed the instance id mechanism
[bookstack] / tests / Meta / RobotsTest.php
1 <?php
2
3 namespace Tests\Meta;
4
5 use Tests\TestCase;
6
7 class RobotsTest extends TestCase
8 {
9     public function test_robots_effected_by_public_status()
10     {
11         $this->get('/robots.txt')->assertSee("User-agent: *\nDisallow: /");
12
13         $this->setSettings(['app-public' => 'true']);
14
15         $resp = $this->get('/robots.txt');
16         $resp->assertSee("User-agent: *\nDisallow:");
17         $resp->assertDontSee('Disallow: /');
18     }
19
20     public function test_robots_effected_by_setting()
21     {
22         $this->get('/robots.txt')->assertSee("User-agent: *\nDisallow: /");
23
24         config()->set('app.allow_robots', true);
25
26         $resp = $this->get('/robots.txt');
27         $resp->assertSee("User-agent: *\nDisallow:");
28         $resp->assertDontSee('Disallow: /');
29
30         // Check config overrides app-public setting
31         config()->set('app.allow_robots', false);
32         $this->setSettings(['app-public' => 'true']);
33         $this->get('/robots.txt')->assertSee("User-agent: *\nDisallow: /");
34     }
35 }