コード例 #1
0
 public function testInvalidData()
 {
     $rawData = array('id' => 'a', 'firstname' => 'Manfred 0815', 'lastname' => '#(9(au', 'street' => '', 'postcode' => '64654564564646464654654654', 'city' => 'M', 'country' => 'it');
     $expectedMessages = array('id' => array('notInt' => 'The input does not appear to be an integer'), 'firstname' => array('notAlpha' => 'The input contains non alphabetic characters'), 'lastname' => array('notAlpha' => 'The input contains non alphabetic characters'), 'street' => array('isEmpty' => 'Value is required and can\'t be empty'), 'postcode' => array('postcodeNoMatch' => 'The input does not appear to be a postal code'), 'city' => array('stringLengthTooShort' => 'The input is less than 3 characters long'), 'country' => array('notInArray' => 'The input was not found in the haystack'));
     $customerInputFilter = new CustomerInputFilter();
     $customerInputFilter->init();
     $customerInputFilter->setData($rawData);
     $this->assertEquals(false, $customerInputFilter->isValid());
     $this->assertEquals($expectedMessages, $customerInputFilter->getMessages());
 }