Example #1
0
 /**
  * Returns true if and only if $value meets the validation requirements
  *
  * If $value fails validation, then this method returns false, and
  * getMessages() will return an array of messages that explain why the
  * validation failed.
  *
  * @param  mixed $value
  * @return bool
  * @throws Exception\RuntimeException If validation of $value is impossible
  */
 public function isValid($value)
 {
     $company = $this->companyService->getBySsn($value);
     if ($company && $company->id != $this->id) {
         $this->error(self::SSN_IN_USE);
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * Test get company SSN exception
  * @expectedException Exception
  */
 public function testGetBySsnException()
 {
     $service = new Company();
     $service->setDataSource(new PDOMock());
     $service->getBySsn('1234567890');
 }