/** * Tear Down */ public function tearDown() { parent::tearDown(); if (FileSystemHelper::isDirectory($this->directory)) { $this->directory->delete(); } }
/** * @covers Corgi\File\Base\FileSystemNode::rename */ public function testRename() { $file = new File($this->fullTestFilePath); $copyPath = $this->getCopyPath($file); $file->touch(); $file->rename($copyPath); $this->assertEquals($copyPath, $file->getPath()); $file->delete(); $directory = new Directory($this->fullTestFilePath); $copyPath = $this->getCopyPath($file); $directory->create(); $directory->rename($copyPath); $this->assertEquals($copyPath, $directory->getPath()); $directory->delete(); }
/** * @covers Corgi\File\Directory::iterate * @depends testCreate */ public function testIterate() { $iterations = new \stdClass(); $iterations->flag = false; $closure = function () use($iterations) { $iterations->flag = true; }; $directory = new Directory(dirname($this->fullTestFilePath)); $file = new File($this->fullTestFilePath); $directory->create(); $file->touch(); $directory->iterate($closure); $file->delete(); $directory->delete(); $this->assertTrue($iterations->flag); }