FileTest.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Form
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. // Call Zend_Form_Element_FileTest::main() if this source file is executed directly.
  23. if (!defined("PHPUnit_MAIN_METHOD")) {
  24. define("PHPUnit_MAIN_METHOD", "Zend_Form_Element_FileTest::main");
  25. }
  26. require_once 'Zend/Form/Element/File.php';
  27. require_once 'Zend/File/Transfer/Adapter/Abstract.php';
  28. require_once 'Zend/Validate/File/Upload.php';
  29. require_once 'Zend/Form/SubForm.php';
  30. require_once 'Zend/Form.php';
  31. require_once 'Zend/Registry.php';
  32. require_once 'Zend/View.php';
  33. /**
  34. * Test class for Zend_Form_Element_File
  35. *
  36. * @category Zend
  37. * @package Zend_Form
  38. * @subpackage UnitTests
  39. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  40. * @license http://framework.zend.com/license/new-bsd New BSD License
  41. * @group Zend_Form
  42. */
  43. class Zend_Form_Element_FileTest extends PHPUnit_Framework_TestCase
  44. {
  45. protected $_errorOccurred = false;
  46. /**
  47. * Runs the test methods of this class.
  48. *
  49. * @return void
  50. */
  51. public static function main()
  52. {
  53. $suite = new PHPUnit_Framework_TestSuite("Zend_Form_Element_FileTest");
  54. $result = PHPUnit_TextUI_TestRunner::run($suite);
  55. }
  56. /**
  57. * Sets up the fixture, for example, open a network connection.
  58. * This method is called before a test is executed.
  59. *
  60. * @return void
  61. */
  62. public function setUp()
  63. {
  64. Zend_Registry::_unsetInstance();
  65. Zend_Form::setDefaultTranslator(null);
  66. $this->element = new Zend_Form_Element_File('foo');
  67. }
  68. /**
  69. * Tears down the fixture, for example, close a network connection.
  70. * This method is called after a test is executed.
  71. *
  72. * @return void
  73. */
  74. public function tearDown()
  75. {
  76. }
  77. public function testElementShouldProxyToParentForDecoratorPluginLoader()
  78. {
  79. $loader = $this->element->getPluginLoader('decorator');
  80. $paths = $loader->getPaths('Zend_Form_Decorator');
  81. $this->assertTrue(is_array($paths));
  82. $loader = new Zend_Loader_PluginLoader;
  83. $this->element->setPluginLoader($loader, 'decorator');
  84. $test = $this->element->getPluginLoader('decorator');
  85. $this->assertSame($loader, $test);
  86. }
  87. public function testElementShouldProxyToParentWhenSettingDecoratorPrefixPaths()
  88. {
  89. $this->element->addPrefixPath('Foo_Decorator', 'Foo/Decorator/', 'decorator');
  90. $loader = $this->element->getPluginLoader('decorator');
  91. $paths = $loader->getPaths('Foo_Decorator');
  92. $this->assertTrue(is_array($paths));
  93. }
  94. public function testElementShouldAddToAllPluginLoadersWhenAddingNullPrefixPath()
  95. {
  96. $this->element->addPrefixPath('Foo', 'Foo');
  97. foreach (array('validate', 'filter', 'decorator', 'transfer_adapter') as $type) {
  98. $loader = $this->element->getPluginLoader($type);
  99. $string = str_replace('_', ' ', $type);
  100. $string = ucwords($string);
  101. $string = str_replace(' ', '_', $string);
  102. $prefix = 'Foo_' . $string;
  103. $paths = $loader->getPaths($prefix);
  104. $this->assertTrue(is_array($paths), "Failed asserting paths found for prefix $prefix");
  105. }
  106. }
  107. public function testElementShouldUseHttpTransferAdapterByDefault()
  108. {
  109. $adapter = $this->element->getTransferAdapter();
  110. $this->assertTrue($adapter instanceof Zend_File_Transfer_Adapter_Http);
  111. }
  112. public function testElementShouldAllowSpecifyingAdapterUsingConcreteInstance()
  113. {
  114. $adapter = new Zend_Form_Element_FileTest_MockAdapter();
  115. $this->element->setTransferAdapter($adapter);
  116. $test = $this->element->getTransferAdapter();
  117. $this->assertSame($adapter, $test);
  118. }
  119. /**
  120. * @expectedException Zend_Form_Element_Exception
  121. */
  122. public function testElementShouldThrowExceptionWhenAddingAdapterOfInvalidType()
  123. {
  124. $this->element->setTransferAdapter(new stdClass);
  125. }
  126. public function testShouldRegisterPluginLoaderWithFileTransferAdapterPathByDefault()
  127. {
  128. $loader = $this->element->getPluginLoader('transfer_adapter');
  129. $this->assertTrue($loader instanceof Zend_Loader_PluginLoader_Interface);
  130. $paths = $loader->getPaths('Zend_File_Transfer_Adapter');
  131. $this->assertTrue(is_array($paths));
  132. }
  133. public function testElementShouldAllowSpecifyingAdapterUsingPluginLoader()
  134. {
  135. $this->element->addPrefixPath('Zend_Form_Element_FileTest_Adapter', dirname(__FILE__) . '/_files/TransferAdapter', 'transfer_adapter');
  136. $this->element->setTransferAdapter('Foo');
  137. $test = $this->element->getTransferAdapter();
  138. $this->assertTrue($test instanceof Zend_Form_Element_FileTest_Adapter_Foo);
  139. }
  140. public function testValidatorAccessAndMutationShouldProxyToAdapter()
  141. {
  142. $this->testElementShouldAllowSpecifyingAdapterUsingConcreteInstance();
  143. $this->element->addValidator('Count', false, 1)
  144. ->addValidators(array(
  145. 'Extension' => 'jpg',
  146. new Zend_Validate_File_Upload(),
  147. ));
  148. $validators = $this->element->getValidators();
  149. $test = $this->element->getTransferAdapter()->getValidators();
  150. $this->assertEquals($validators, $test);
  151. $this->assertTrue(is_array($test));
  152. $this->assertEquals(3, count($test));
  153. $validator = $this->element->getValidator('count');
  154. $test = $this->element->getTransferAdapter()->getValidator('count');
  155. $this->assertNotNull($validator);
  156. $this->assertSame($validator, $test);
  157. $this->element->removeValidator('Extension');
  158. $this->assertFalse($this->element->getTransferAdapter()->hasValidator('Extension'));
  159. $this->element->setValidators(array(
  160. 'Upload',
  161. array('validator' => 'Extension', 'options' => 'jpg'),
  162. array('validator' => 'Count', 'options' => 1),
  163. ));
  164. $validators = $this->element->getValidators();
  165. $test = $this->element->getTransferAdapter()->getValidators();
  166. $this->assertSame($validators, $test);
  167. $this->assertTrue(is_array($test));
  168. $this->assertEquals(3, count($test), var_export($test, 1));
  169. $this->element->clearValidators();
  170. $validators = $this->element->getValidators();
  171. $this->assertTrue(is_array($validators));
  172. $this->assertEquals(0, count($validators));
  173. $test = $this->element->getTransferAdapter()->getValidators();
  174. $this->assertSame($validators, $test);
  175. }
  176. public function testValidationShouldProxyToAdapter()
  177. {
  178. $this->markTestIncomplete('Unsure how to accurately test');
  179. $this->element->setTransferAdapter(new Zend_Form_Element_FileTest_MockAdapter);
  180. $this->element->addValidator('Regex', '/([a-z0-9]{13})$/i');
  181. $this->assertTrue($this->element->isValid('foo.jpg'));
  182. }
  183. public function testDestinationMutatorsShouldProxyToTransferAdapter()
  184. {
  185. $adapter = new Zend_Form_Element_FileTest_MockAdapter();
  186. $this->element->setTransferAdapter($adapter);
  187. $this->element->setDestination(dirname(__FILE__));
  188. $this->assertEquals(dirname(__FILE__), $this->element->getDestination());
  189. $this->assertEquals(dirname(__FILE__), $this->element->getTransferAdapter()->getDestination('foo'));
  190. }
  191. public function testSettingMultipleFiles()
  192. {
  193. $this->element->setMultiFile(3);
  194. $this->assertEquals(3, $this->element->getMultiFile());
  195. }
  196. public function testFileInSubSubSubform()
  197. {
  198. $form = new Zend_Form();
  199. $element = new Zend_Form_Element_File('file1');
  200. $element2 = new Zend_Form_Element_File('file2');
  201. $subform0 = new Zend_Form_SubForm();
  202. $subform0->addElement($element);
  203. $subform0->addElement($element2);
  204. $subform1 = new Zend_Form_SubForm();
  205. $subform1->addSubform($subform0, 'subform0');
  206. $subform2 = new Zend_Form_SubForm();
  207. $subform2->addSubform($subform1, 'subform1');
  208. $subform3 = new Zend_Form_SubForm();
  209. $subform3->addSubform($subform2, 'subform2');
  210. $form->addSubform($subform3, 'subform3');
  211. $form->setView(new Zend_View());
  212. $output = (string) $form;
  213. $this->assertContains('name="file1"', $output);
  214. $this->assertContains('name="file2"', $output);
  215. }
  216. public function testMultiFileInSubSubSubform()
  217. {
  218. $form = new Zend_Form();
  219. $element = new Zend_Form_Element_File('file');
  220. $element->setMultiFile(2);
  221. $subform0 = new Zend_Form_SubForm();
  222. $subform0->addElement($element);
  223. $subform1 = new Zend_Form_SubForm();
  224. $subform1->addSubform($subform0, 'subform0');
  225. $subform2 = new Zend_Form_SubForm();
  226. $subform2->addSubform($subform1, 'subform1');
  227. $subform3 = new Zend_Form_SubForm();
  228. $subform3->addSubform($subform2, 'subform2');
  229. $form->addSubform($subform3, 'subform3');
  230. $form->setView(new Zend_View());
  231. $output = (string) $form;
  232. $this->assertContains('name="file[]"', $output);
  233. $this->assertEquals(2, substr_count($output, 'file[]'));
  234. }
  235. public function testMultiFileWithOneFile()
  236. {
  237. $form = new Zend_Form();
  238. $element = new Zend_Form_Element_File('file');
  239. $element->setMultiFile(1);
  240. $subform0 = new Zend_Form_SubForm();
  241. $subform0->addElement($element);
  242. $subform1 = new Zend_Form_SubForm();
  243. $subform1->addSubform($subform0, 'subform0');
  244. $subform2 = new Zend_Form_SubForm();
  245. $subform2->addSubform($subform1, 'subform1');
  246. $subform3 = new Zend_Form_SubForm();
  247. $subform3->addSubform($subform2, 'subform2');
  248. $form->addSubform($subform3, 'subform3');
  249. $form->setView(new Zend_View());
  250. $output = (string) $form;
  251. $this->assertNotContains('name="file[]"', $output);
  252. }
  253. public function testSettingMaxFileSize()
  254. {
  255. $max = $this->_convertIniToInteger(trim(ini_get('upload_max_filesize')));
  256. $this->assertEquals(0, $this->element->getMaxFileSize());
  257. $this->element->setMaxFileSize($max);
  258. $this->assertEquals($max, $this->element->getMaxFileSize());
  259. $this->_errorOccurred = false;
  260. set_error_handler(array($this, 'errorHandlerIgnore'));
  261. $this->element->setMaxFileSize(999999999999);
  262. if (!$this->_errorOccurred) {
  263. $this->fail('INI exception expected');
  264. }
  265. restore_error_handler();
  266. }
  267. public function testAutoGetPostMaxSize()
  268. {
  269. $this->element->setMaxFileSize(-1);
  270. $this->assertNotEquals(-1, $this->element->getMaxFileSize());
  271. }
  272. public function testTranslatingValidatorErrors()
  273. {
  274. require_once 'Zend/Translate.php';
  275. $translate = new Zend_Translate('array', array('unused', 'foo' => 'bar'), 'en');
  276. $this->element->setTranslator($translate);
  277. $adapter = $this->element->getTranslator();
  278. $this->assertTrue($adapter instanceof Zend_Translate_Adapter_Array);
  279. $adapter = $this->element->getTransferAdapter();
  280. $adapter = $adapter->getTranslator();
  281. $this->assertTrue($adapter instanceof Zend_Translate_Adapter_Array);
  282. $this->assertFalse($this->element->translatorIsDisabled());
  283. $this->element->setDisableTranslator($translate);
  284. $this->assertTrue($this->element->translatorIsDisabled());
  285. }
  286. public function testFileNameWithoutPath()
  287. {
  288. $this->element->setTransferAdapter(new Zend_Form_Element_FileTest_MockAdapter());
  289. $this->element->setDestination(dirname(__FILE__));
  290. $this->assertEquals(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'foo.jpg', $this->element->getFileName('foo', true));
  291. $this->assertEquals('foo.jpg', $this->element->getFileName('foo', false));
  292. }
  293. public function testEmptyFileName()
  294. {
  295. $this->element->setTransferAdapter(new Zend_Form_Element_FileTest_MockAdapter());
  296. $this->element->setDestination(dirname(__FILE__));
  297. $this->assertEquals(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'foo.jpg', $this->element->getFileName());
  298. }
  299. public function testIsReceived()
  300. {
  301. $this->element->setTransferAdapter(new Zend_Form_Element_FileTest_MockAdapter());
  302. $this->assertEquals(false, $this->element->isReceived());
  303. }
  304. public function testIsUploaded()
  305. {
  306. $this->element->setTransferAdapter(new Zend_Form_Element_FileTest_MockAdapter());
  307. $this->assertEquals(true, $this->element->isUploaded());
  308. }
  309. public function testIsFiltered()
  310. {
  311. $this->element->setTransferAdapter(new Zend_Form_Element_FileTest_MockAdapter());
  312. $this->assertEquals(true, $this->element->isFiltered());
  313. }
  314. public function testDefaultDecorators()
  315. {
  316. $this->element->clearDecorators();
  317. $this->assertEquals(array(), $this->element->getDecorators());
  318. $this->element->setDisableLoadDefaultDecorators(true);
  319. $this->element->loadDefaultDecorators();
  320. $this->assertEquals(array(), $this->element->getDecorators());
  321. $this->element->setDisableLoadDefaultDecorators(false);
  322. $this->element->loadDefaultDecorators();
  323. $this->assertNotEquals(array(), $this->element->getDecorators());
  324. }
  325. public function testValueGetAndSet()
  326. {
  327. $this->element->setTransferAdapter(new Zend_Form_Element_FileTest_MockAdapter());
  328. $this->assertEquals(null, $this->element->getValue());
  329. $this->element->setValue('something');
  330. $this->assertEquals(null, $this->element->getValue());
  331. }
  332. public function testMarkerInterfaceForFileElement()
  333. {
  334. $this->element->setDecorators(array('ViewHelper'));
  335. $this->assertEquals(1, count($this->element->getDecorators()));
  336. try {
  337. $content = $this->element->render(new Zend_View());
  338. $this->fail();
  339. } catch (Zend_Form_Element_Exception $e) {
  340. $this->assertContains('No file decorator found', $e->getMessage());
  341. }
  342. }
  343. public function testFileSize()
  344. {
  345. $element = new Zend_Form_Element_File('baz');
  346. $adapter = new Zend_Form_Element_FileTest_MockAdapter();
  347. $element->setTransferAdapter($adapter);
  348. $this->assertEquals('1.14kB', $element->getFileSize('baz.text'));
  349. $adapter->setOptions(array('useByteString' => false));
  350. $this->assertEquals(1172, $element->getFileSize('baz.text'));
  351. }
  352. public function testMimeType()
  353. {
  354. $element = new Zend_Form_Element_File('baz');
  355. $adapter = new Zend_Form_Element_FileTest_MockAdapter();
  356. $element->setTransferAdapter($adapter);
  357. $this->assertEquals('text/plain', $element->getMimeType('baz.text'));
  358. }
  359. public function testAddedErrorsAreDisplayed()
  360. {
  361. Zend_Form::setDefaultTranslator(null);
  362. $element = new Zend_Form_Element_File('baz');
  363. $element->addError('TestError3');
  364. $adapter = new Zend_Form_Element_FileTest_MockAdapter();
  365. $element->setTransferAdapter($adapter);
  366. $this->assertTrue($element->hasErrors());
  367. $messages = $element->getMessages();
  368. $this->assertContains('TestError3', $messages);
  369. }
  370. public function testGetTranslatorRetrievesGlobalDefaultWhenAvailable()
  371. {
  372. $this->assertNull($this->element->getTranslator());
  373. $translator = new Zend_Translate('array', array('foo' => 'bar'));
  374. require_once 'Zend/Form.php';
  375. Zend_Form::setDefaultTranslator($translator);
  376. $received = $this->element->getTranslator();
  377. $this->assertSame($translator->getAdapter(), $received);
  378. }
  379. public function testDefaultDecoratorsContainDescription()
  380. {
  381. $element = new Zend_Form_Element_File('baz');
  382. $decorators = $element->getDecorator('Description');
  383. $this->assertTrue($decorators instanceof Zend_Form_Decorator_Description);
  384. }
  385. private function _convertIniToInteger($setting)
  386. {
  387. if (!is_numeric($setting)) {
  388. $type = strtoupper(substr($setting, -1));
  389. $setting = (integer) substr($setting, 0, -1);
  390. switch ($type) {
  391. case 'M' :
  392. $setting *= 1024;
  393. break;
  394. case 'G' :
  395. $setting *= 1024 * 1024;
  396. break;
  397. default :
  398. break;
  399. }
  400. }
  401. return (integer) $setting;
  402. }
  403. /**
  404. * Ignores a raised PHP error when in effect, but throws a flag to indicate an error occurred
  405. *
  406. * @param integer $errno
  407. * @param string $errstr
  408. * @param string $errfile
  409. * @param integer $errline
  410. * @param array $errcontext
  411. * @return void
  412. */
  413. public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $errcontext)
  414. {
  415. $this->_errorOccurred = true;
  416. }
  417. /**
  418. * Prove the fluent interface on Zend_Form_Element_File::loadDefaultDecorators
  419. *
  420. * @link http://framework.zend.com/issues/browse/ZF-9913
  421. * @return void
  422. */
  423. public function testFluentInterfaceOnLoadDefaultDecorators()
  424. {
  425. $this->assertSame($this->element, $this->element->loadDefaultDecorators());
  426. }
  427. /**
  428. * @group ZF-12173
  429. */
  430. public function testElementShouldAllowAdapterWithBackslahes()
  431. {
  432. if (version_compare(PHP_VERSION, '5.3.0', '<')) {
  433. $this->markTestSkipped(
  434. __CLASS__ . '::' . __METHOD__ . ' requires PHP 5.3.0 or greater'
  435. );
  436. return;
  437. }
  438. $this->element->addPrefixPath(
  439. 'Zend\Form\Element\FileTest\Adapter',
  440. dirname(__FILE__) . '/_files/TransferAdapter',
  441. 'transfer_adapter'
  442. );
  443. $this->element->setTransferAdapter('Bar');
  444. $test = $this->element->getTransferAdapter();
  445. $this->assertTrue(
  446. $test instanceof \Zend\Form\Element\FileTest\Adapter\Bar
  447. );
  448. }
  449. /**
  450. * @group ZF-12210
  451. */
  452. public function testAutoInsertNotEmptyValidator()
  453. {
  454. $this->testElementShouldAllowSpecifyingAdapterUsingConcreteInstance();
  455. $this->element->setRequired(true);
  456. // Test before validation
  457. $this->assertNull($this->element->getValidator('NotEmpty'));
  458. // Test after validation
  459. $this->element->isValid('foo.jpg');
  460. $this->assertTrue(
  461. $this->element->getValidator('NotEmpty') instanceof Zend_Validate_NotEmpty
  462. );
  463. }
  464. }
  465. class Zend_Form_Element_FileTest_MockAdapter extends Zend_File_Transfer_Adapter_Abstract
  466. {
  467. public $received = false;
  468. public function __construct()
  469. {
  470. $testfile = dirname(__FILE__) . '/../../File/Transfer/Adapter/_files/test.txt';
  471. $this->_files = array(
  472. 'foo' => array(
  473. 'name' => 'foo.jpg',
  474. 'type' => 'image/jpeg',
  475. 'size' => 126976,
  476. 'tmp_name' => '/tmp/489127ba5c89c',
  477. 'options' => array('ignoreNoFile' => false, 'useByteString' => true),
  478. 'validated' => false,
  479. 'received' => false,
  480. 'filtered' => false,
  481. 'validators' => array(),
  482. ),
  483. 'bar' => array(
  484. 'name' => 'bar.png',
  485. 'type' => 'image/png',
  486. 'size' => 91136,
  487. 'tmp_name' => '/tmp/489128284b51f',
  488. 'options' => array('ignoreNoFile' => false, 'useByteString' => true),
  489. 'validated' => false,
  490. 'received' => false,
  491. 'filtered' => false,
  492. 'validators' => array(),
  493. ),
  494. 'baz' => array(
  495. 'name' => 'baz.text',
  496. 'type' => 'text/plain',
  497. 'size' => 1172,
  498. 'tmp_name' => $testfile,
  499. 'options' => array('ignoreNoFile' => false, 'useByteString' => true),
  500. 'validated' => false,
  501. 'received' => false,
  502. 'filtered' => false,
  503. 'validators' => array(),
  504. ),
  505. 'file_1_' => array(
  506. 'name' => 'baz.text',
  507. 'type' => 'text/plain',
  508. 'size' => 1172,
  509. 'tmp_name' => '/tmp/4891286cceff3',
  510. 'options' => array('ignoreNoFile' => false, 'useByteString' => true),
  511. 'validated' => false,
  512. 'received' => false,
  513. 'filtered' => false,
  514. 'validators' => array(),
  515. ),
  516. 'file_2_' => array(
  517. 'name' => 'baz.text',
  518. 'type' => 'text/plain',
  519. 'size' => 1172,
  520. 'tmp_name' => '/tmp/4891286cceff3',
  521. 'options' => array('ignoreNoFile' => false, 'useByteString' => true),
  522. 'validated' => false,
  523. 'received' => false,
  524. 'filtered' => false,
  525. 'validators' => array(),
  526. ),
  527. );
  528. }
  529. public function send($options = null)
  530. {
  531. return;
  532. }
  533. public function receive($options = null)
  534. {
  535. $this->received = true;
  536. return;
  537. }
  538. public function isSent($file = null)
  539. {
  540. return false;
  541. }
  542. public function isReceived($file = null)
  543. {
  544. return $this->received;
  545. }
  546. public function isUploaded($files = null)
  547. {
  548. return true;
  549. }
  550. public function isFiltered($files = null)
  551. {
  552. return true;
  553. }
  554. public static function getProgress()
  555. {
  556. return;
  557. }
  558. }
  559. // Call Zend_Form_Element_FileTest::main() if this source file is executed directly.
  560. if (PHPUnit_MAIN_METHOD == "Zend_Form_Element_FileTest::main") {
  561. Zend_Form_Element_FileTest::main();
  562. }