Skip to content

Commit 514f9fb

Browse files
committed
Noindex test
1 parent 3189f8a commit 514f9fb

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

test/cases/NoindexTest.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
namespace vipnytt\XRobotsTagParser\tests;
4+
5+
use vipnytt\XRobotsTagParser;
6+
7+
class NoindexTest extends \PHPUnit_Framework_TestCase
8+
{
9+
/**
10+
* noindex test
11+
*
12+
* @dataProvider generateDataForTest
13+
* @param string $url
14+
* @param string $bot
15+
* @param array $options
16+
*/
17+
public function testNoIndex($url, $bot, $options)
18+
{
19+
$parser = new XRobotsTagParser($url, $bot, $options);
20+
$this->assertInstanceOf('vipnytt\XRobotsTagParser', $parser);
21+
22+
$this->assertTrue($parser->getRules(true)['noindex']);
23+
$this->assertTrue($parser->getRules(false)['noindex']);
24+
$this->assertTrue($parser->getRules(false)['noarchive']);
25+
}
26+
27+
/**
28+
* Generate test data
29+
* @return array
30+
*/
31+
public function generateDataForTest()
32+
{
33+
return [
34+
[
35+
'http://example.com/',
36+
'googlebot',
37+
['headers' =>
38+
[
39+
'X-Robots-Tag: noindex'
40+
]
41+
]
42+
]
43+
];
44+
}
45+
}

0 commit comments

Comments
 (0)