/**
  * @expectedException \LogicException
  */
 public function testOverwritePersonDifferentIdThrowsException()
 {
     $donor = new Donor();
     $donor->setId(1);
     $donor->setFirstName('Test');
     $this->phoneNumber->setPerson($donor);
     $this->assertEquals($donor, $this->phoneNumber->getPerson());
     $secondDonor = new Donor();
     $secondDonor->setId(2);
     $this->phoneNumber->setPerson($secondDonor);
 }
 public function testSetGetPerson()
 {
     $donor = new Donor();
     $donor->setFirstname('Test')->setSurname('Recipient');
     $address = new Address();
     $address->setAddressLine('Test Address')->setTown('Some Town')->setPostcode('Postcode');
     $donor->addAddress($address);
     $this->correspondence->setCorrespondent($donor);
     $this->assertInstanceOf('Opg\\Core\\Model\\Entity\\CaseActor\\Donor', $this->correspondence->getCorrespondent());
     $this->assertEquals($donor, $this->correspondence->getCorrespondent());
     $this->assertEquals($address, $this->correspondence->getCorrespondent()->getAddresses()->toArray()[0]);
 }
コード例 #3
0
 /**
  * @return \Opg\Common\Model\Entity\Traits\InputFilter|\Zend\InputFilter\InputFilter|\Zend\InputFilter\InputFilterInterface
  */
 public function getInputFilter()
 {
     if (!$this->inputFilter) {
         $this->inputFilter = parent::getInputFilter();
         $this->inputFilter->merge(new ClientFilter());
     }
     return $this->inputFilter;
 }
コード例 #4
0
 public function testAddPerson()
 {
     $donor = new Donor();
     $donor->setId('1');
     $this->epa->addPerson($donor);
     $this->assertEquals($donor, $this->epa->getDonor());
     $attorney = new Attorney();
     $attorney->setId('1');
     $this->epa->addPerson($attorney);
     $this->assertEquals($attorney, $this->epa->getAttorneys()[0]);
     $personNotifyDonor = new PersonNotifyDonor();
     $personNotifyDonor->setId('1');
     $this->epa->addPerson($personNotifyDonor);
     $this->assertEquals($personNotifyDonor, $this->epa->getPersonNotifyDonor());
     $notifiedRelative = new NotifiedRelative();
     $notifiedRelative->setId('1');
     $this->epa->addPerson($notifiedRelative);
     $this->assertEquals($notifiedRelative, $this->epa->getNotifiedRelatives()[0]);
     $notifiedAttorney = new NotifiedAttorney();
     $notifiedAttorney->setId('1');
     $this->epa->addPerson($notifiedAttorney);
     $this->assertEquals($notifiedAttorney, $this->epa->getNotifiedAttorneys()[0]);
     $correspondent = new Correspondent();
     $correspondent->setId('1');
     $this->epa->addPerson($correspondent);
     $this->assertEquals($correspondent, $this->epa->getCorrespondent());
     $person = $this->getMockForAbstractClass('Opg\\Core\\Model\\Entity\\CaseActor\\Person');
     $person->setId('1');
     try {
         $this->epa->addPerson($person);
     } catch (\Exception $e) {
         $this->assertTrue($e instanceof \LogicException);
         $this->assertFalse($e instanceof UnusedException);
     }
 }
コード例 #5
0
 public function testToString()
 {
     $expected = "Test *1*2*3*Test Town*Test County*SW3 4HG*Test Country";
     $donor = new Donor();
     $donor->setId(1);
     $donor->setFirstName('Test');
     $this->address->setPerson($donor);
     $this->assertEquals($donor, $this->address->getPerson());
     $this->address->setAddressLines(array(1, 2, 3))->setTown('Test Town')->setCounty('Test County')->setPostcode('SW3 4HG')->setCountry('Test Country');
     $result = $this->address->toString('*', Address::INCLUDE_PERSON, 0b111);
     $this->assertEquals($expected, trim($result));
 }