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); }
/** * Trigger database schema checks if required. * * @param GetResponseEvent $event */ protected function schemaCheck(GetResponseEvent $event) { $session = $event->getRequest()->getSession(); $validSession = $session->isStarted() && $session->get('authentication'); $expired = $this->schemaManager->isCheckRequired(); // Don't show the check if we're in the dbcheck already. $notInCheck = !in_array($event->getRequest()->get('_route'), ['dbupdate', '_wdt']); if ($validSession && $expired && $this->schemaManager->isUpdateRequired() && $notInCheck) { $msg = Trans::__("The database needs to be updated/repaired. Go to 'Configuration' > '<a href=\"%link%\">Check Database</a>' to do this now.", ['%link%' => $this->urlGenerator->generate('dbcheck')]); $this->loggerFlash->error($msg); } }