/** * Ensures that setHash() returns expected value * * @return void */ public function testSetHash() { $validator = new File\Hash('12345'); $validator->setHash('12333'); $this->assertEquals(array('12333' => 'crc32'), $validator->getHash()); $validator->setHash(array('12321', '12121')); $this->assertEquals(array('12321' => 'crc32', '12121' => 'crc32'), $validator->getHash()); }
/** * Sets the crc32 hash for one or multiple files * * @param string|array $options * @return \Zend\Validator\File\Hash Provides a fluent interface */ public function setHash($options) { if (!is_array($options)) { $options = array($options); } $options['algorithm'] = 'crc32'; parent::setHash($options); return $this; }
/** * Sets the md5 hash for one or multiple files * * @param string|array $options * @param string $algorithm (Deprecated) Algorithm to use, fixed to md5 * @return \Zend\Validator\File\Hash Provides a fluent interface */ public function setHash($options) { if (!is_array($options)) { $options = (array) $options; } $options['algorithm'] = 'md5'; parent::setHash($options); return $this; }