add composer's vendor directory
This commit is contained in:
parent
01a3860d73
commit
60b094d5fa
745 changed files with 56017 additions and 1 deletions
43
vendor/codeguy/upload/tests/Validation/ExtensionTest.php
vendored
Normal file
43
vendor/codeguy/upload/tests/Validation/ExtensionTest.php
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
class ExtensionTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Setup (each test)
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
// Path to test assets
|
||||
$this->assetsDirectory = dirname(__DIR__) . '/assets';
|
||||
|
||||
// Create stubbed storage instance
|
||||
$this->storage = $this->getMock(
|
||||
'\Upload\Storage\FileSystem',
|
||||
array('upload'),
|
||||
array($this->assetsDirectory)
|
||||
);
|
||||
$this->storage->expects($this->any())
|
||||
->method('upload')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
// Reset $_FILES superglobal
|
||||
$_FILES['foo'] = array(
|
||||
'name' => 'foo.txt',
|
||||
'tmp_name' => $this->assetsDirectory . '/foo.txt',
|
||||
'error' => 0
|
||||
);
|
||||
}
|
||||
|
||||
public function testValidExtension()
|
||||
{
|
||||
$file = new \Upload\File('foo', $this->storage);
|
||||
$validation = new \Upload\Validation\Extension('txt');
|
||||
$this->assertTrue($validation->validate($file));
|
||||
}
|
||||
|
||||
public function testInvalidExtension()
|
||||
{
|
||||
$file = new \Upload\File('foo', $this->storage);
|
||||
$validation = new \Upload\Validation\Extension('csv');
|
||||
$this->assertFalse($validation->validate($file));
|
||||
}
|
||||
}
|
Reference in a new issue