public function testIsRegionValid()
 {
     /** @var \PHPUnit_Framework_MockObject_MockObject|Country $country */
     $country = $this->getMockBuilder('Oro\\Bundle\\AddressBundle\\Entity\\Country')->disableOriginalConstructor()->getMock();
     $country->expects($this->once())->method('hasRegions')->will($this->returnValue(true));
     $country->expects($this->once())->method('getName')->will($this->returnValue('Country'));
     $this->context->expects($this->once())->method('getPropertyPath')->will($this->returnValue('test'));
     $this->context->expects($this->once())->method('addViolationAt')->with('test.region', $this->constraint->message, ['{{ country }}' => 'Country']);
     $address = $this->createAddress();
     $address->setCountry($country);
     $this->validator->validate($address, $this->constraint);
 }
Exemplo n.º 2
0
 /**
  * @param ExecutionContextInterface $context
  * @deprecated Use \Oro\Bundle\AddressBundle\Validator\Constraints\ValidRegionValidator instead
  */
 public function isRegionValid(ExecutionContextInterface $context)
 {
     // Use validator instead of duplicate code
     $constraint = new ValidRegion();
     $validator = new ValidRegionValidator();
     $validator->initialize($context);
     $validator->validate($this, $constraint);
 }