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