/**
  * @dataProvider normalizeDataProvider
  */
 public function testNormalize($base_url, $url, $secure, $expected_normalized_components)
 {
     $normalizer = new Normalizer($base_url);
     $page_url_annotation = new PageUrlAnnotation();
     $page_url_annotation->url = $url;
     $page_url_annotation->secure = $secure;
     $this->assertEquals($expected_normalized_components, $normalizer->normalize($page_url_annotation));
 }
Exemple #2
0
 /**
  * Initializes the page.
  *
  * @param Page $page Page to initialize.
  *
  * @return self
  */
 public function initPage(Page $page)
 {
     /* @var $annotations PageUrlAnnotation[] */
     $annotations = $this->annotationManager->getClassAnnotations($page, '@page-url');
     if (!$annotations || !$annotations[0] instanceof PageUrlAnnotation) {
         return $this;
     }
     $page->setUrlBuilder($this->urlFactory->getBuilder($this->urlNormalizer->normalize($annotations[0])));
     return $this;
 }