/** * @dataProvider initAnnotationDataProvider */ public function testInitAnnotation(array $annotation_params, $expected_path, $expected_params, $expected_anchor, $expected_secure, $expected_host, $expected_port, $expected_user, $expected_pass) { $annotation = new MatchUrlComponentAnnotation(); $annotation->initAnnotation($annotation_params); $this->assertEquals($expected_path, $annotation->path); $this->assertEquals($expected_params, $annotation->params); $this->assertEquals($expected_anchor, $annotation->anchor); $this->assertEquals($expected_secure, $annotation->secure); $this->assertEquals($expected_host, $annotation->host); $this->assertEquals($expected_port, $annotation->port); $this->assertEquals($expected_user, $annotation->user); $this->assertEquals($expected_pass, $annotation->pass); $this->assertTrue($annotation->isValid()); }
/** * Sets expectation for url match annotations and returns them. * * @param AnnotationManager $annotation_manager The annotation manager. * @param array $annotations_data Url match. * * @return array */ protected function expectMatchUrlComponentAnnotation(Page $page, $annotations_data = array()) { $annotations = array(); foreach ($annotations_data as $annotation_params) { $annotation = new MatchUrlComponentAnnotation(); $annotation->initAnnotation($annotation_params); $annotations[] = $annotation; } $this->annotationManager->shouldReceive('getClassAnnotations')->with($page, '@match-url-component')->andReturn($annotations); return $annotations; }
/** * Creates annotation instance, that matcher will use. * * @param array $parameters Parameters. * * @return MatchUrlComponentAnnotation */ public function createAnnotation(array $parameters) { $annotation = new MatchUrlComponentAnnotation(); $annotation->initAnnotation($parameters); return $annotation; }