/** * @group ZF-9605 */ public function testInvalidTypeGiven() { $validator = new Zend_Validate_Isbn(); $validator->setType(Zend_Validate_Isbn::ISBN13); $this->assertFalse($validator->isValid((double) 1.2345)); $this->assertFalse($validator->isValid((object) 'Test')); }
/** * Ensures that the validator follows expected behavior * * @return void */ public function testType13() { $validator = new Zend_Validate_Isbn(); $validator->setType(Zend_Validate_Isbn::ISBN13); $this->assertFalse($validator->isValid('0060929871')); $this->assertTrue($validator->isValid('9780555023402')); $validator->setSeparator('-'); $this->assertFalse($validator->isValid('0-06-092987-1')); $this->assertTrue($validator->isValid('978-0-555023-40-2')); $validator->setSeparator(' '); $this->assertFalse($validator->isValid('0 06 092987 1')); $this->assertTrue($validator->isValid('978 0 555023 40 2')); }