/** * @dataProvider provideLifecycle */ public function testLifecycle($options, $shouldInvalidate) { if ($options['has_structure']) { $this->request->attributes->set('structure', $this->structure->reveal()); } if ($options['preview']) { $this->request->query->set('preview', true); } $this->filterResponseEvent->getResponse()->willReturn($this->response); $this->filterResponseEvent->getRequest()->willReturn($this->request); $this->filterResponseEvent->isMasterRequest()->willReturn($options['is_master_request']); $invalidateProphecy = $this->handler->updateResponse($this->response, Argument::any()); if ($shouldInvalidate) { $invalidateProphecy->shouldBeCalled(); } else { $invalidateProphecy->shouldNotBeCalled(); } $this->subscriber->onResponse($this->filterResponseEvent->reveal()); }