Updated file type tests
This commit is contained in:
parent
83a2f0bebe
commit
1107284a5d
4 changed files with 6 additions and 1 deletions
|
@ -64,6 +64,10 @@ class FileType extends Validator
|
||||||
*/
|
*/
|
||||||
public function isValid($path)
|
public function isValid($path)
|
||||||
{
|
{
|
||||||
|
if(!\is_readable($path)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$handle = fopen($path, 'r');
|
$handle = fopen($path, 'r');
|
||||||
|
|
||||||
if (!$handle) {
|
if (!$handle) {
|
||||||
|
|
BIN
tests/resources/disk-b/kitten-1.png
Normal file
BIN
tests/resources/disk-b/kitten-1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 MiB |
BIN
tests/resources/disk-b/kitten-2.png
Normal file
BIN
tests/resources/disk-b/kitten-2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 674 KiB |
|
@ -25,6 +25,7 @@ class FileTypeTest extends TestCase
|
||||||
{
|
{
|
||||||
$this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-a/kitten-1.jpg'), true);
|
$this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-a/kitten-1.jpg'), true);
|
||||||
$this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-a/kitten-2.jpg'), true);
|
$this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-a/kitten-2.jpg'), true);
|
||||||
$this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-a/kitten-2.jpg'), true);
|
$this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-b/kitten-1.png'), false);
|
||||||
|
$this->assertEquals($this->object->isValid(__DIR__ . '/../../../resources/disk-b/kitten-2.png'), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue