/** * @dataProvider initPageDataProvider */ public function testInitPage($url, array $params, $secure, $use_url_builder) { $url_components = parse_url($url); $annotations = $this->expectPageUrlAnnotation($url, $params, $secure); /* @var $page Page */ $page = m::mock($this->pageClass); $url_builder = m::mock(self::URL_BUILDER_INTERFACE); /** @var Normalizer $url_normalizer */ $url_normalizer = m::mock(self::URL_NORMALIZER_CLASS); $this->realFactory->setUrlFactory($this->urlFactory); $this->realFactory->setUrlNormalizer($url_normalizer); $url_normalizer->shouldReceive('normalize')->with(reset($annotations))->times(isset($url) ? 1 : 0)->andReturn($url_components); $this->urlFactory->shouldReceive('getBuilder')->with($url_components)->times(isset($url) ? 1 : 0)->andReturn($url_builder); $page->shouldReceive('setUrlBuilder')->times($use_url_builder ? 1 : 0)->andReturn($page); $this->assertSame($this->realFactory, $this->realFactory->initPage($page)); }