コード例 #1
0
 /**
  * Check
  * Returns true if no errors occured otherwise false
  * This should be considered a strict check as even case
  * sensitivity will cause an error
  *
  * @access public
  * @return bool
  */
 public function check()
 {
     $errors = $this->parser->getErrors();
     if (count($errors) > 0) {
         return false;
     }
     return true;
 }
コード例 #2
0
 public function test_improper_directive_case()
 {
     $contents = file_get_contents($this->_file_path('impropercase'));
     $this->parser = new Glow\Robots\Parser($contents);
     $errors = $this->parser->getErrors();
     $this->assertCount(1, $errors);
     $this->assertEquals($errors[0]['code'], 2);
     $this->assertEquals($errors[0]['message'], 'Allow directive has improper casing - allow should be [Allow]');
     $this->assertEquals($errors[0]['line'], 2);
     $this->assertEquals($errors[0]['level'], 'WARN');
 }
コード例 #3
0
 public function test_set_elements()
 {
     $array = array('TEST' => 'VALUE');
     $this->parser->setElements($array);
     $this->assertEquals($this->parser->getElements(), $array);
 }
コード例 #4
0
 public function test_isdisallowed()
 {
     $this->assertTrue($this->parser->isDisallowed('/help/cnnx.html'));
     $this->assertFalse($this->parser->isDisallowed('/somegoodurl.php'));
 }
コード例 #5
0
 public function test_set_elements_non_array()
 {
     $this->setExpectedException('ErrorException');
     $this->parser->setElements(new stdClass());
 }
コード例 #6
0
 public function test_property_default_tr()
 {
     //$this->assertNull($this->parser->getTR());
     $this->assertInstanceOf('tomverran\\Robot\\RobotsTxt', $this->parser->getTR());
 }