/** * Test show * * @param int $blockMaxAge * @param string $status * * @dataProvider provideMaxAge */ public function testShow($blockMaxAge, $status) { Phake::when($this->block)->getMaxAge()->thenReturn($blockMaxAge); $response = Phake::mock('Symfony\\Component\\HttpFoundation\\Response'); Phake::when($this->strategy)->show($this->block)->thenReturn($response); Phake::when($this->strategy)->isPublic($this->block)->thenReturn($status == 'public'); Phake::when($this->cacheableManager)->setResponseCacheParameters(Phake::anyParameters())->thenReturn($response); $newResponse = $this->manager->show($this->block); $this->assertSame($response, $newResponse); Phake::verify($this->wrongStrategy, Phake::never())->show(Phake::anyParameters()); Phake::verify($this->eventDispatcher)->dispatch(BlockEvents::PRE_BLOCK_RENDER, new BlockEvent($this->block)); Phake::verify($this->strategy)->show(Phake::anyParameters()); Phake::verify($this->eventDispatcher)->dispatch(BlockEvents::POST_BLOCK_RENDER, new BlockEvent($this->block, $newResponse)); Phake::verify($this->cacheableManager)->setResponseCacheParameters($response, $blockMaxAge, $status); }