/**
  * @expectedException \QATools\QATools\PageObject\Exception\PageUrlMatcherException
  * @expectedExceptionMessage The "@one" annotation is not valid.
  * @expectedExceptionCode \QATools\QATools\PageObject\Exception\PageUrlMatcherException::TYPE_INVALID_ANNOTATION
  */
 public function testInvalidAnnotations()
 {
     $annotation_class = '\\QATools\\QATools\\PageObject\\Annotation\\IMatchUrlAnnotation';
     $annotation = m::mock($annotation_class);
     $annotation->shouldReceive('isValid')->andReturn(false);
     $annotations = array($annotation);
     $matcher = m::mock(self::MATCHER_INTERFACE);
     $matcher->shouldReceive('getPriority')->andReturn(1);
     $matcher->shouldReceive('getAnnotationName')->andReturn('one');
     $matcher->shouldReceive('getAnnotationClass')->andReturn($annotation_class);
     $matcher->shouldReceive('matches')->with('/', $annotations)->never();
     $this->pageUrlMatcherRegistry->add($matcher);
     $this->annotationManager->shouldReceive('getClassAnnotations')->with($this->page, '@one')->andReturn($annotations);
     $this->pageUrlMatcherRegistry->match('/', $this->page);
 }
Exemple #2
0
 /**
  * Checks if the given page is currently opened in browser.
  *
  * @param Page $page Page to check.
  *
  * @return boolean
  */
 public function opened(Page $page)
 {
     return $this->pageUrlMatcherRegistry->match($this->_session->getCurrentUrl(), $page);
 }