public function testWarmUpWithWarmebleInterface() { $containerMock =
$this->
getMockBuilder(ContainerInterface::
class)->
onlyMethods(['get', 'has'
])->
getMock();
$routerMock =
$this->
getMockBuilder(testRouterInterfaceWithWarmebleInterface::
class)->
onlyMethods(['match', 'generate', 'getContext', 'setContext', 'getRouteCollection', 'warmUp'
])->
getMock();
$containerMock->
expects($this->
any())->
method('get'
)->
with('router'
)->
willReturn($routerMock);
$routerCacheWarmer =
new RouterCacheWarmer($containerMock);
$routerCacheWarmer->
warmUp('/tmp'
);
$routerMock->
expects($this->
any())->
method('warmUp'
)->
with('/tmp'
)->
willReturn([]);
$this->
addToAssertionCount(1
);
} public function testWarmUpWithoutWarmebleInterface() { $containerMock =
$this->
getMockBuilder(ContainerInterface::
class)->
onlyMethods(['get', 'has'
])->
getMock();
$routerMock =
$this->
getMockBuilder(testRouterInterfaceWithoutWarmebleInterface::
class)->
onlyMethods(['match', 'generate', 'getContext', 'setContext', 'getRouteCollection'
])->
getMock();
$containerMock->
expects($this->
any())->
method('get'
)->
with('router'
)->
willReturn($routerMock);
$routerCacheWarmer =
new RouterCacheWarmer($containerMock);
$this->
expectException(\LogicException::
class);
$this->
expectExceptionMessage('cannot be warmed up because it does not implement "Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface"'
);