public function testValidationFailsOnNon3DigitBranchCodes() { $this->account->setBranchCode('1234'); $this->assertSame('1234', $this->account->getBranchCode()); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 1); $this->assertTrue(count($violations->get('branchCode')) === 1); $this->account->setBranchCode('123 '); $this->assertSame('123 ', $this->account->getBranchCode()); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 1); $this->assertTrue(count($violations->get('branchCode')) === 1); $this->account->setBranchCode('12'); $this->assertSame('12', $this->account->getBranchCode()); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 1); $this->assertTrue(count($violations->get('branchCode')) === 1); $this->account->setBranchCode('123'); $this->assertSame('123', $this->account->getBranchCode()); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 1); $this->assertTrue(count($violations->get('branchCode')) === 1); $this->account->setBranchCode('123'); $this->assertSame('123', $this->account->getBranchCode()); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 0); $this->account->setBranchCode(''); $this->assertSame('', $this->account->getBranchCode()); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 1); $this->assertTrue(count($violations->get('branchCode')) === 1); $this->account->setBranchCode(null); $this->assertSame(null, $this->account->getBranchCode()); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 1); $this->assertTrue(count($violations->get('branchCode')) === 1); }