コード例 #1
0
 function it_gets_province_code_if_its_abbreviation_is_not_set(RepositoryInterface $provinceRepository, ProvinceInterface $province)
 {
     $province->getCode()->willReturn('IE-UL');
     $province->getAbbreviation()->willReturn(null);
     $provinceRepository->findOneBy(['code' => 'IE-UL'])->willReturn($province);
     $this->getAbbreviation('IE-UL')->shouldReturn('IE-UL');
 }
コード例 #2
0
 function it_adds_or_removes_provinces_on_pre_set_data(FormFactoryInterface $formFactory, FormEvent $event, FormInterface $form, FormInterface $provinceForm, AddressInterface $address, CountryInterface $country, ProvinceInterface $province)
 {
     $event->getForm()->willReturn($form);
     $event->getData()->willReturn($address);
     $country->getCode()->willReturn('IE');
     $address->getCountryCode()->willReturn('IE');
     $country->hasProvinces()->willReturn(true);
     $province->getCode()->willReturn('province');
     $address->getProvinceCode()->willReturn('province');
     $formFactory->createNamed('provinceCode', 'sylius_province_code_choice', 'province', Argument::withKey('country'))->willReturn($provinceForm);
     $this->preSetData($event);
 }
コード例 #3
0
ファイル: CountrySpec.php プロジェクト: gabiudrescu/Sylius
 function it_sets_country_on_added_province(ProvinceInterface $province)
 {
     $province->setCountry($this)->shouldBeCalled();
     $this->addProvince($province);
 }
コード例 #4
0
 function it_matches_address_from_province_when_many_are_found(RepositoryInterface $repository, CountryInterface $country, ProvinceInterface $province, AddressInterface $address, ZoneMemberInterface $memberCountry, ZoneMemberInterface $memberProvince, ZoneInterface $zoneCountry, ZoneInterface $zoneProvince)
 {
     $province->getCode()->willReturn('DU');
     $country->getCode()->willReturn('IE');
     $address->getCountryCode()->willReturn('IE');
     $address->getProvinceCode()->willReturn('DU');
     $memberCountry->getCode()->willReturn('IE');
     $memberProvince->getCode()->willReturn('DU');
     $zoneProvince->getMembers()->willReturn([$memberProvince]);
     $zoneProvince->getType()->willReturn(ZoneInterface::TYPE_PROVINCE);
     $zoneCountry->getMembers()->willReturn([$memberCountry]);
     $zoneCountry->getType()->willReturn(ZoneInterface::TYPE_COUNTRY);
     $repository->findAll()->willReturn([$zoneCountry, $zoneProvince]);
     $memberProvince->getBelongsTo()->willReturn($zoneProvince);
     $memberCountry->getBelongsTo()->willReturn($zoneCountry);
     $this->match($address)->shouldReturn($zoneProvince);
 }
コード例 #5
0
 function it_returns_province_name(ProvinceInterface $province)
 {
     $province->getName()->willReturn('Łódzkie');
     $this->setProvince($province);
     $this->getName()->shouldReturn('Łódzkie');
 }