Author: Gawain Lynch (gawain.lynch@gmail.com)
Exemplo n.º 1
0
 public function setUp()
 {
     $this->user = $this->prophesize(Users::class);
     $this->timedRecord = $this->prophesize(TimedRecord::class);
     $this->schemaManager = $this->prophesize(SchemaManagerInterface::class);
     $this->urlGenerator = $this->prophesize(UrlGeneratorInterface::class);
     $this->flashLogger = $this->prophesize(FlashLoggerInterface::class);
     $this->passwordFactory = $this->prophesize(PasswordFactory::class);
     $this->listener = new StorageEventListener($this->timedRecord->reveal(), $this->schemaManager->reveal(), $this->urlGenerator->reveal(), $this->flashLogger->reveal(), $this->passwordFactory->reveal(), 5, false);
     $this->storageEvent = $this->prophesize(StorageEvent::class);
 }
Exemplo n.º 2
0
 /**
  * Kernel request listener callback.
  *
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     if (!$event->isMasterRequest()) {
         return;
     }
     if ($this->isProfilerRequest($event->getRequest())) {
         return;
     }
     $this->schemaCheck($event);
     // Check if we need to 'publish' any 'timed' records, or 'hold' any expired records.
     if ($this->timedRecordsEnabled && $this->timedRecord->isDuePublish()) {
         $this->timedRecord->publishTimedRecords();
     }
     if ($this->timedRecordsEnabled && $this->timedRecord->isDueHold()) {
         $this->timedRecord->holdExpiredRecords();
     }
 }