-
Notifications
You must be signed in to change notification settings - Fork 3
/
RobotsTest.php
101 lines (70 loc) · 2.14 KB
/
RobotsTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
namespace Robots\Tests;
class RobotsTest extends TestCase
{
public function setUp()
{
parent::setUp();
}
public function testAddAllow()
{
$this->robots->reset();
$this->robots->addAllow('foo');
$this->assertEquals('Allow: foo', $this->robots->generate());
}
public function testAddAllows()
{
$this->robots->reset();
$this->robots->addAllow(['foo', 'bar']);
$this->assertEquals("Allow: foo\nAllow: bar", $this->robots->generate());
}
public function testAddComments()
{
$this->robots->reset();
$this->robots->addComment('foo');
$this->assertEquals('# foo', $this->robots->generate());
}
public function testAddDisallow()
{
$this->robots->reset();
$this->robots->addDisallow('foo');
$this->assertEquals('Disallow: foo', $this->robots->generate());
}
public function testAddDisallows()
{
$this->robots->reset();
$this->robots->addDisallow(['foo', 'bar']);
$this->assertEquals("Disallow: foo\nDisallow: bar", $this->robots->generate());
}
public function testAddHost()
{
$this->robots->reset();
$this->robots->addHost('foo');
$this->assertEquals('Host: foo', $this->robots->generate());
}
public function testAddSitemap()
{
$this->robots->reset();
$this->robots->addSitemap('foo');
$this->assertEquals('Sitemap: foo', $this->robots->generate());
}
public function testAddSpacer()
{
$this->robots->reset();
$this->robots->addSpacer();
$this->assertEquals('', $this->robots->generate());
}
public function testAddUserAgent()
{
$this->robots->reset();
$this->robots->addUserAgent('foo');
$this->assertEquals('User-agent: foo', $this->robots->generate());
}
public function testConcatenate()
{
$response = $this->robots->reset()
->addUserAgent('foo')
->generate();
$this->assertEquals('User-agent: foo', $response);
}
}