/** * @group ZF-11258 */ public function testZF11258() { $validator = new File\Md5('12345'); $this->assertFalse($validator->isValid(__DIR__ . '/_files/nofile.mo')); $this->assertTrue(array_key_exists('fileMd5NotFound', $validator->getMessages())); $this->assertContains("'nofile.mo'", current($validator->getMessages())); }
/** * Ensures that addHash() returns expected value * * @return void */ public function testAddHash() { $validator = new File\Md5('12345'); $validator->addHash('12344'); $this->assertEquals(array('12345' => 'md5', '12344' => 'md5'), $validator->getMd5()); $validator->addHash(array('12321', '12121')); $this->assertEquals(array('12345' => 'md5', '12344' => 'md5', '12321' => 'md5', '12121' => 'md5'), $validator->getMd5()); }
public function testEmptyFileShouldReturnFalseAndDisplayNotFoundMessage() { $validator = new File\Md5(); $this->assertFalse($validator->isValid('')); $this->assertArrayHasKey(File\Md5::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\Md5::NOT_FOUND, $validator->getMessages()); }