get(Filesystem::class); $this->varDirectoryWriter = $filesystem->getDirectoryWrite(DirectoryList::VAR_DIR); $this->filePermissions = $objectManager->create(FilePermissions::class, [ 'filesystem' => $filesystem, 'directoryList' => $objectManager->get(DirectoryList::class), 'state' => $objectManager->get(State::class), ]); } /** * Checks the depth of recursive check permissions */ public function testDeepOfRecursiveCheckPermissions() { $dirs = [ 'dir1', 'dir2/dir21', 'dir2/dir22/dir221', 'dir3/dir31/dir311/dir3111', ]; foreach ($dirs as $dir) { $pathToReadOnlyDir = $this->testDir . '/' . $dir; $this->varDirectoryWriter->create($pathToReadOnlyDir); $this->varDirectoryWriter->changePermissionsRecursively($pathToReadOnlyDir, 0555, 0444); } $missingWritablePathsForInstallation = $this->filePermissions->getMissingWritablePathsForInstallation(); $this->assertCount(1, $missingWritablePathsForInstallation); $this->assertEquals('dir1', basename($missingWritablePathsForInstallation[0])); } /** * @inheritdoc */ protected function tearDown() { if ($this->varDirectoryWriter->isExist($this->testDir)) { $this->varDirectoryWriter->delete($this->testDir); } } }