/** * Ensures that setImageMin() returns expected value * * @return void */ public function testSetImageMin() { $validator = new File\ImageSize(array('minWidth' => 100, 'minHeight' => 1000, 'maxWidth' => 10000, 'maxHeight' => 100000)); $validator->setImageMin(array('minWidth' => 10, 'minHeight' => 10)); $this->assertEquals(array('minWidth' => 10, 'minHeight' => 10), $validator->getImageMin()); $validator->setImageMin(array('minWidth' => 9, 'minHeight' => 100)); $this->assertEquals(array('minWidth' => 9, 'minHeight' => 100), $validator->getImageMin()); $this->setExpectedException('Zend\\Validator\\Exception\\InvalidArgumentException', 'less than or equal'); $validator->setImageMin(array('minWidth' => 20000, 'minHeight' => 20000)); }
/** * Ensures that setImageMin() returns expected value * * @return void */ public function testSetImageMin() { $validator = new File\ImageSize(array('minwidth' => 100, 'minheight' => 1000, 'maxwidth' => 10000, 'maxheight' => 100000)); $validator->setImageMin(array('minwidth' => 10, 'minheight' => 10)); $this->assertEquals(array('minwidth' => 10, 'minheight' => 10), $validator->getImageMin()); $validator->setImageMin(array('minwidth' => 9, 'minheight' => 100)); $this->assertEquals(array('minwidth' => 9, 'minheight' => 100), $validator->getImageMin()); try { $validator->setImageMin(array('minwidth' => 20000, 'minheight' => 20000)); $this->fail("Missing exception"); } catch (Validator\Exception $e) { $this->assertContains("less than or equal", $e->getMessage()); } }