public function testCaseTesting() { $files = array('name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => __DIR__ . '/_files/testsize.mo', 'error' => 0); $validator = new File\ExcludeExtension(array('MO', 'case' => true)); $this->assertEquals(true, $validator->isValid(__DIR__ . '/_files/testsize.mo', $files)); $validator = new File\ExcludeExtension(array('MO', 'case' => false)); $this->assertEquals(false, $validator->isValid(__DIR__ . '/_files/testsize.mo', $files)); }
/** * @group ZF-11258 */ public function testZF11258() { $validator = new File\ExcludeExtension('mo'); $this->assertEquals(false, $validator->isValid(__DIR__ . '/_files/nofile.mo')); $this->assertTrue(array_key_exists('fileExcludeExtensionNotFound', $validator->getMessages())); $this->assertContains("does not exist", current($validator->getMessages())); }
public function testEmptyFileShouldReturnFalseAndDisplayNotFoundMessage() { $validator = new File\ExcludeExtension('12345'); $this->assertFalse($validator->isValid('')); $this->assertArrayHasKey(File\ExcludeExtension::NOT_FOUND, $validator->getMessages()); $filesArray = array('name' => '', 'size' => 0, 'tmp_name' => '', 'error' => UPLOAD_ERR_NO_FILE, 'type' => ''); $this->assertFalse($validator->isValid($filesArray)); $this->assertArrayHasKey(File\ExcludeExtension::NOT_FOUND, $validator->getMessages()); }