/**
  * Ensures that setImageMax() returns expected value
  *
  * @return void
  */
 public function testSetImageMax()
 {
     $validator = new Zend_Validate_File_ImageSize(array('minwidth' => 10, 'minheight' => 100, 'maxwidth' => 1000, 'maxheight' => 10000));
     $validator->setImageMax(array('maxwidth' => 100, 'maxheight' => 100));
     $this->assertEquals(array('maxwidth' => 100, 'maxheight' => 100), $validator->getImageMax());
     $validator->setImageMax(array('maxwidth' => 110, 'maxheight' => 1000));
     $this->assertEquals(array('maxwidth' => 110, 'maxheight' => 1000), $validator->getImageMax());
     $validator->setImageMax(array('maxheight' => 1100));
     $this->assertEquals(array('maxwidth' => 110, 'maxheight' => 1100), $validator->getImageMax());
     $validator->setImageMax(array('maxwidth' => 120));
     $this->assertEquals(array('maxwidth' => 120, 'maxheight' => 1100), $validator->getImageMax());
     try {
         $validator->setImageMax(array('maxwidth' => 10000, 'maxheight' => 1));
         $this->fail("Missing exception");
     } catch (Zend_Validate_Exception $e) {
         $this->assertContains("greater than or equal", $e->getMessage());
     }
 }
Exemplo n.º 2
0
 /**
  * Ensures that setImageMax() returns expected value
  *
  * @return void
  */
 public function testSetImageMax()
 {
     $validator = new Zend_Validate_File_ImageSize(10, 100, 1000, 10000);
     $validator->setImageMax(100, 100);
     $this->assertEquals(array(100, 100), $validator->getImageMax());
     $validator->setImageMax(110, 1000);
     $this->assertEquals(array(110, 1000), $validator->getImageMax());
     $validator->setImageMax(null, 1100);
     $this->assertEquals(array(null, 1100), $validator->getImageMax());
     $validator->setImageMax(120, null);
     $this->assertEquals(array(120, null), $validator->getImageMax());
     try {
         $validator->setImageMax(10000, 1);
         $this->fail("Missing exception");
     } catch (Zend_Validate_Exception $e) {
         $this->assertContains("greater than or equal", $e->getMessage());
     }
 }