function it_adds_violation_because_address_has_no_province(AddressInterface $address, Country $country, ProvinceAddressConstraint $constraint, ExecutionContextInterface $context, RepositoryInterface $repository)
 {
     $country->getCode()->willReturn('IE');
     $address->getCountry()->willreturn('IE');
     $repository->findOneBy(array('code' => 'IE'))->willReturn($country);
     $country->hasProvinces()->willreturn(true);
     $address->getProvince()->willreturn(null);
     $this->initialize($context);
     $context->getPropertyPath()->willReturn('property_path');
     $context->getViolations()->willReturn(new \ArrayIterator(array($this->createViolation('other_property_path'))));
     $context->addViolation(Argument::any())->shouldBeCalled();
     $this->validate($address, $constraint);
 }
 function it_does_not_add_a_violation_if_province_is_valid(AddressInterface $address, Country $country, Province $province, ProvinceAddressConstraint $constraint, ExecutionContextInterface $context, RepositoryInterface $countryRepository, RepositoryInterface $provinceRepository)
 {
     $country->getCode()->willReturn('US');
     $address->getCountryCode()->willReturn('US');
     $countryRepository->findOneBy(['code' => 'US'])->willReturn($country);
     $country->hasProvinces()->willReturn(true);
     $address->getProvinceCode()->willReturn('US-AK');
     $province->getCode()->willReturn('US-AK');
     $provinceRepository->findOneBy(['code' => 'US-AK'])->willReturn($province);
     $country->hasProvince($province)->willReturn(true);
     $this->initialize($context);
     $context->getPropertyPath()->willReturn('property_path');
     $context->getViolations()->willReturn(new \ArrayIterator([$this->createViolation('other_property_path')]));
     $context->addViolation(Argument::any())->shouldNotBeCalled();
     $this->validate($address, $constraint);
 }