diff --git a/src/FileUpload/FileSystem/Mock.php b/src/FileUpload/FileSystem/Mock.php deleted file mode 100644 index 9ebb164..0000000 --- a/src/FileUpload/FileSystem/Mock.php +++ /dev/null @@ -1,94 +0,0 @@ -main_path = $main_path; - } - - /** - * @see PathResolver - */ - public function getUploadPath($name = null) - { - return $this->main_path . '/' . $name; - } - - /** - * @see PathResolver - */ - public function upcountName($name) - { - return preg_replace_callback('/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/', function ($matches) { - $index = isset($matches[1]) ? intval($matches[1]) + 1 : 1; - $ext = isset($matches[2]) ? $matches[2] : ''; - - return ' (' . $index . ')' . $ext; - }, $name, 1); - } -} diff --git a/tests/FileUpload/FileSystem/SimpleTest.php b/tests/FileUpload/FileSystem/SimpleTest.php deleted file mode 100644 index 24e1f0a..0000000 --- a/tests/FileUpload/FileSystem/SimpleTest.php +++ /dev/null @@ -1,58 +0,0 @@ -filesystem = new Simple(); - - if(! is_dir($playground_path)) { - mkdir($playground_path); - } - - if(! is_file($playground_path . '/yadda.txt')) { - copy($fixtures_path . '/yadda.txt', $playground_path . '/yadda.txt'); - } - } - - public function testIsFile() { - $this->assertTrue($this->filesystem->isFile(__DIR__ . '/../../fixtures/real-image.jpg')); - $this->assertFalse($this->filesystem->isFile(__DIR__ . '/../../fixtures')); - } - - public function testIsDir() { - $this->assertFalse($this->filesystem->isDir(__DIR__ . '/../../fixtures/real-image.jpg')); - $this->assertTrue($this->filesystem->isDir(__DIR__ . '/../../fixtures')); - } - - public function testWriteToFile() { - $yadda = __DIR__ . '/../../playground/yadda.txt'; - $path = __DIR__ . '/../../playground/test.1.txt'; - - $this->filesystem->writeToFile($path, $this->filesystem->getFileStream($yadda)); - $this->assertEquals(file_get_contents($yadda), file_get_contents($path)); - - $this->filesystem->unlink($path); - } - - public function testMoveUploadedFile() { - $yadda = __DIR__ . '/../../playground/yadda.txt'; - $path = __DIR__ . '/../../playground/test.2.txt'; - - $original_yadda = file_get_contents($yadda); - - $this->filesystem->moveUploadedFile($yadda, $path); - $this->assertEquals($original_yadda, file_get_contents($path)); - - $this->filesystem->moveUploadedFile($path, $yadda); - } - - public function testGetFilesize() { - $this->assertEquals(20 * 1024, $this->filesystem->getFilesize(__DIR__ . '/../../fixtures/blob')); - } -} diff --git a/tests/FileUpload/PathResolver/SimpleTest.php b/tests/FileUpload/PathResolver/SimpleTest.php deleted file mode 100644 index f7be08f..0000000 --- a/tests/FileUpload/PathResolver/SimpleTest.php +++ /dev/null @@ -1,16 +0,0 @@ -assertEquals(__DIR__ . '/../../fixtures/real-image.jpg', $resolver->getUploadPath('real-image.jpg')); - } - - public function testUpcountName() { - $resolver = new Simple(__DIR__ . '/../../fixtures'); - $this->assertEquals('real-image (1).jpg', $resolver->upcountName('real-image.jpg')); - $this->assertEquals('real-image (2).jpg', $resolver->upcountName('real-image (1).jpg')); - } -}