Contao\CoreBundle\Test\Routing\UrlGeneratorTest::getGenerator PHP Method

getGenerator() private method

Returns an UrlGenerator object.
private getGenerator ( boolean $prependLocale = false, integer $returnArgument = 1, boolean $useAutoItem = true ) : UrlGenerator
$prependLocale boolean
$returnArgument integer
$useAutoItem boolean
return Contao\CoreBundle\Routing\UrlGenerator
    private function getGenerator($prependLocale = false, $returnArgument = 1, $useAutoItem = true)
    {
        /** @var UrlGeneratorInterface|\PHPUnit_Framework_MockObject_MockObject $router */
        $router = $this->getMock('Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface');
        $router->expects($this->any())->method('generate')->willReturnArgument($returnArgument);
        $router->expects($this->any())->method('getContext')->willReturn(new RequestContext());
        /** @var Adapter|\PHPUnit_Framework_MockObject_MockObject $configAdapter */
        $configAdapter = $this->getMockBuilder('Contao\\CoreBundle\\Framework\\Adapter')->setMethods(['isComplete', 'preload', 'getInstance', 'get'])->disableOriginalConstructor()->getMock();
        $configAdapter->expects($this->any())->method('isComplete')->willReturn(true);
        $configAdapter->expects($this->any())->method('preload')->willReturn(null);
        $configAdapter->expects($this->any())->method('getInstance')->willReturn(null);
        $configAdapter->expects($this->any())->method('get')->willReturnCallback(function ($key) use($useAutoItem) {
            switch ($key) {
                case 'useAutoItem':
                    return $useAutoItem;
                case 'timeZone':
                    return 'Europe/Berlin';
                default:
                    return null;
            }
        });
        return new UrlGenerator($router, $this->mockContaoFramework(null, null, ['Contao\\Config' => $configAdapter]), $prependLocale);
    }