Neos\Flow\Tests\Unit\Monitor\FileMonitorTest::detectChangesAddsCreatedFilesOfMonitoredDirectoriesToStoredDirectories PHP Method

detectChangesAddsCreatedFilesOfMonitoredDirectoriesToStoredDirectories() public method

    public function detectChangesAddsCreatedFilesOfMonitoredDirectoriesToStoredDirectories()
    {
        $testPath = vfsStream::url('testDirectory');
        // Initially known files per path
        $knownDirectoriesAndFiles = [];
        // Create a new file
        file_put_contents($testPath . '/test.txt', '');
        // Outcome of the change dection per file
        $changeDetectionResult = [$testPath . '/test.txt' => ChangeDetectionStrategyInterface::STATUS_CREATED];
        // Expected emitted changes for files
        $expectedEmittedChanges = [$testPath . '/test.txt' => ChangeDetectionStrategyInterface::STATUS_CREATED];
        $fileMonitor = $this->setUpFileMonitorForDetection($changeDetectionResult, $expectedEmittedChanges, $knownDirectoriesAndFiles);
        $fileMonitor->monitorDirectory($testPath);
        $fileMonitor->detectChanges();
        $this->assertEquals([$testPath . '/test.txt' => ChangeDetectionStrategyInterface::STATUS_CREATED], $fileMonitor->_get('changedFiles'));
        $this->assertCount(1, $fileMonitor->_get('changedPaths'));
    }