public function testGetSetMvcEvent()
 {
     $cacheEvent = new CacheEvent();
     $mvcEvent = new MvcEvent();
     $cacheEvent->setMvcEvent($mvcEvent);
     $this->assertEquals($mvcEvent, $cacheEvent->getMvcEvent());
 }
 public function testShouldCacheCallsShouldCacheOnStrategy()
 {
     $mvcEvent = new MvcEvent();
     $cacheEvent = new CacheEvent();
     $cacheEvent->setMvcEvent($mvcEvent);
     $this->strategyMock->shouldReceive('shouldCache')->once()->with($mvcEvent);
     $this->listener->shouldCache($cacheEvent);
 }
 public function testShouldCacheIsCalledOnConcreteClasses()
 {
     $mvcEvent = new MvcEvent();
     $event = new CacheEvent();
     $event->setMvcEvent($mvcEvent);
     $this->strategy->shouldCacheCallback($event);
     $this->assertTrue($this->strategy->shouldCacheCalled);
     $this->assertSame($this->strategy->mvcEvent, $mvcEvent);
 }
 /**
  * @param  CacheEvent $event
  * @return bool
  */
 public function shouldCacheCallback(CacheEvent $event)
 {
     return $this->shouldCache($event->getMvcEvent());
 }
Пример #5
0
 /**
  * @param  string        $eventName
  * @param  MvcEvent|null $mvcEvent
  * @return CacheEvent
  */
 protected function createCacheEvent($eventName, MvcEvent $mvcEvent = null)
 {
     $cacheEvent = new CacheEvent($eventName, $this);
     $cacheEvent->setMvcEvent($mvcEvent);
     return $cacheEvent;
 }
 /**
  * @param  CacheEvent $event
  * @return bool
  */
 public function shouldCache(CacheEvent $event)
 {
     return $this->getStrategy()->shouldCache($event->getMvcEvent());
 }