Ejemplo n.º 1
0
 public function testValidateAddressesOneInvalidNoKeys()
 {
     $invalidAddress = $this->_addressBuilder->setFirstname('Freddy')->setLastname('Mercury')->create();
     try {
         $this->_service->validateAddresses(array_merge($this->_expectedAddresses, array($invalidAddress)));
         $this->fail("InputException was expected but not thrown");
     } catch (InputException $actualException) {
         $expectedException = new InputException();
         $expectedException->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'street', 'index' => 2]);
         $expectedException->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'city', 'index' => 2]);
         $expectedException->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'telephone', 'index' => 2]);
         $expectedException->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'postcode', 'index' => 2]);
         $expectedException->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'countryId', 'index' => 2]);
         $this->assertEquals($expectedException, $actualException);
     }
 }