/**
  * Ensures that setMax() returns expected value
  *
  * @return void
  */
 public function testSetMax()
 {
     $validator = new Zend_Validate_File_Size(array('max' => 0, 'bytestring' => true));
     $this->assertEquals('0B', $validator->getMax());
     $validator->setMax(1000000);
     $this->assertEquals('976.56kB', $validator->getMax());
     $validator->setMin(100);
     $this->assertEquals('976.56kB', $validator->getMax());
     $validator->setMax('100 AB');
     $this->assertEquals('100B', $validator->getMax());
     $validator->setMax('100 kB');
     $this->assertEquals('100kB', $validator->getMax());
     $validator->setMax('100 MB');
     $this->assertEquals('100MB', $validator->getMax());
     $validator->setMax('1 GB');
     $this->assertEquals('1GB', $validator->getMax());
     $validator->setMax('0.001 TB');
     $this->assertEquals('1.02GB', $validator->getMax());
     $validator->setMax('0.000001 PB');
     $this->assertEquals('1.05GB', $validator->getMax());
     $validator->setMax('0.000000001 EB');
     $this->assertEquals('1.07GB', $validator->getMax());
     $validator->setMax('0.000000000001 ZB');
     $this->assertEquals('1.1GB', $validator->getMax());
     $validator->setMax('0.000000000000001 YB');
     $this->assertEquals('1.13GB', $validator->getMax());
 }
Esempio n. 2
0
 /**
  * Ensures that setMax() returns expected value
  *
  * @return void
  */
 public function testSetMax()
 {
     $validator = new Zend_Validate_File_Size(1000, 10000);
     $validator->setMax(1000000);
     $this->assertEquals('976.56kB', $validator->getMax());
     $validator->setMin(100);
     $this->assertEquals('976.56kB', $validator->getMax());
 }