public function testValidationFailsOnNon10DigitCompanyCodes() { $this->account->setCompanyCode('01234567890'); $this->assertSame('01234567890', $this->account->getCompanyCode()); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 1); $this->assertTrue(count($violations->get('companyCode')) === 1); $this->account->setCompanyCode('012345678'); $this->assertSame('012345678', $this->account->getCompanyCode()); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 1); $this->assertTrue(count($violations->get('companyCode')) === 1); $this->account->setCompanyCode('0123456789'); $this->assertSame('0123456789', $this->account->getCompanyCode()); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 1); $this->assertTrue(count($violations->get('companyCode')) === 1); $this->account->setCompanyCode('0123456789'); $this->assertSame('0123456789', $this->account->getCompanyCode()); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 0); //Not required. $this->account->setCompanyCode(''); $this->assertSame('', $this->account->getCompanyCode()); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 0); //Not required. $this->account->setCompanyCode(null); $this->assertSame(null, $this->account->getCompanyCode()); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 0); }