public function testGetJsonApiPath() { /** @var UrlGeneratorInterface|\PHPUnit_Framework_MockObject_MockObject $urlGenerator */ $urlGenerator = $this->getMock('Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface', array('generate', 'setContext', 'getContext')); $urlGenerator->expects($this->once())->method('generate')->with($this->equalTo('tq_extdirect_api'), $this->equalTo(array('endpoint' => 'api', '_format' => 'json')))->willReturn('url'); $extension = new TemplatingHelper($urlGenerator); $this->assertEquals('url', $extension->getApiPath('api', 'json')); }
/** * @param string $endpoint * @param string $format * @return string */ public function getApiPath($endpoint, $format = 'js') { return $this->templatingHelper->getApiPath($endpoint, $format); }