File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments