示例#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');
 }
 public function test_set_elements()
 {
     $array = array('TEST' => 'VALUE');
     $this->parser->setElements($array);
     $this->assertEquals($this->parser->getElements(), $array);
 }
 public function test_isdisallowed()
 {
     $this->assertTrue($this->parser->isDisallowed('/help/cnnx.html'));
     $this->assertFalse($this->parser->isDisallowed('/somegoodurl.php'));
 }
 public function test_set_elements_non_array()
 {
     $this->setExpectedException('ErrorException');
     $this->parser->setElements(new stdClass());
 }
 public function test_property_default_tr()
 {
     //$this->assertNull($this->parser->getTR());
     $this->assertInstanceOf('tomverran\\Robot\\RobotsTxt', $this->parser->getTR());
 }