diff --git a/tests/unit/Storage/StorageTest.php b/tests/unit/Storage/StorageTest.php new file mode 100644 index 000000000..c20c91407 --- /dev/null +++ b/tests/unit/Storage/StorageTest.php @@ -0,0 +1,42 @@ +assertEquals(get_class(Storage::getDevice('disk-a')), 'Storage\Devices\Local'); + $this->assertEquals(get_class(Storage::getDevice('disk-b')), 'Storage\Devices\Local'); + + try { + get_class(Storage::getDevice('disk-c')); + $this->fail("Expected exception not thrown"); + } catch(Exception $e) { + $this->assertEquals('The device "disk-c" is not listed', $e->getMessage()); + } + } + + public function testExists() + { + $this->assertEquals(Storage::exists('disk-a'), true); + $this->assertEquals(Storage::exists('disk-b'), true); + $this->assertEquals(Storage::exists('disk-c'), false); + } +} \ No newline at end of file diff --git a/tests/unit/Storage/Validators/FileNameTest.php b/tests/unit/Storage/Validators/FileNameTest.php new file mode 100644 index 000000000..c22182ea9 --- /dev/null +++ b/tests/unit/Storage/Validators/FileNameTest.php @@ -0,0 +1,33 @@ +object = new FileName(); + } + + public function tearDown() + { + } + + public function testValues() + { + $this->assertEquals($this->object->isValid(''), false); + $this->assertEquals($this->object->isValid(null), false); + $this->assertEquals($this->object->isValid(false), false); + $this->assertEquals($this->object->isValid('../test'), false); + $this->assertEquals($this->object->isValid('test.png'), true); + $this->assertEquals($this->object->isValid('test'), true); + } +} \ No newline at end of file diff --git a/tests/unit/Storage/Validators/FileSizeTest.php b/tests/unit/Storage/Validators/FileSizeTest.php new file mode 100644 index 000000000..c4acd175e --- /dev/null +++ b/tests/unit/Storage/Validators/FileSizeTest.php @@ -0,0 +1,30 @@ +object = new FileSize(1000); + } + + public function tearDown() + { + } + + public function testValues() + { + $this->assertEquals($this->object->isValid(1001), false); + $this->assertEquals($this->object->isValid(1000), true); + $this->assertEquals($this->object->isValid(999), true); + } +} \ No newline at end of file