Example #1
0
 /**
  * @test
  */
 public function aDirectoryAppearsOnlyOnceInTheListOfMonitoredDirectories()
 {
     $monitor = new \TYPO3\FLOW3\Monitor\FileMonitor('FLOW3_Test');
     $monitor->monitorDirectory(__DIR__);
     $monitor->monitorDirectory(__DIR__ . '/');
     $this->assertSame(array($this->unixStylePath), $monitor->getMonitoredDirectories());
 }
Example #2
0
 /**
  * Factory method for conveniently building a file monitor using a
  * ModificationTimeStrategy.
  *
  * @param string $monitorIdentifier Identifier for the new file monitor
  * @param \TYPO3\FLOW3\Core\Bootstrap $bootstrap The bootstrap instance
  * @return \TYPO3\FLOW3\Monitor\FileMonitor
  */
 protected static function createFileMonitor($monitorIdentifier, Bootstrap $bootstrap)
 {
     $fileMonitorCache = $bootstrap->getEarlyInstance('TYPO3\\FLOW3\\Cache\\CacheManager')->getCache('FLOW3_Monitor');
     // The change detector needs to be instantiated and registered manually because
     // it has a complex dependency (cache) but still needs to be a singleton.
     $fileChangeDetector = new \TYPO3\FLOW3\Monitor\ChangeDetectionStrategy\ModificationTimeStrategy();
     $fileChangeDetector->injectCache($fileMonitorCache);
     $bootstrap->getObjectManager()->registerShutdownObject($fileChangeDetector, 'shutdownObject');
     $fileMonitor = new \TYPO3\FLOW3\Monitor\FileMonitor($monitorIdentifier);
     $fileMonitor->injectCache($fileMonitorCache);
     $fileMonitor->injectChangeDetectionStrategy($fileChangeDetector);
     $fileMonitor->injectSignalDispatcher($bootstrap->getEarlyInstance('TYPO3\\FLOW3\\SignalSlot\\Dispatcher'));
     $fileMonitor->injectSystemLogger($bootstrap->getEarlyInstance('TYPO3\\FLOW3\\Log\\SystemLoggerInterface'));
     $fileMonitor->initializeObject();
     return $fileMonitor;
 }