Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Commit

Permalink
APOLLO-3232 Updated unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brettminnie committed Jun 19, 2014
1 parent 145f8aa commit 73f7f50
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Opg/Core/Model/Entity/PhoneNumber/PhoneNumber.php
Expand Up @@ -161,13 +161,13 @@ public function getType()
return $this->type;
}

/**
* @return InputFilterTrait|\Zend\InputFilter\InputFilter|\Zend\InputFilter\InputFilterInterface
*/
public function getInputFilter()
{
if (!$this->inputFilter) {
$inputFilter = new \Zend\InputFilter\InputFilter();
$factory = new \Zend\InputFilter\Factory();

$this->inputFilter = $inputFilter;
$this->inputFilter = new \Zend\InputFilter\InputFilter();
}

return $this->inputFilter;
Expand Down
13 changes: 13 additions & 0 deletions tests/OpgTest/Core/Model/Entity/CaseItem/Lpa/Party/DonorTest.php
@@ -1,6 +1,7 @@
<?php
namespace OpgTest\Common\Model\Entity\CaseItem\Lpa\Party;

use Opg\Core\Model\Entity\CaseItem\Lpa\Party\Attorney;
use Opg\Core\Model\Entity\CaseItem\Lpa\Party\Donor;
use Opg\Common\Model\Entity\DateFormat as OPGDateFormat;
/**
Expand Down Expand Up @@ -189,4 +190,16 @@ public function testIdOutOfRangeFails()
$this->donor->getErrorMessages()['errors']['id']['outOfRange']
);
}

/**
* @expectedException \LogicException
*/
public function testLinkDonorWithAttorneyFails()
{
$attorney = (new Attorney)->setId(22);

$this->donor->setId(1);

$this->donor->addChild($attorney);
}
}
9 changes: 9 additions & 0 deletions tests/OpgTest/Core/Model/Entity/Person/PersonTest.php
Expand Up @@ -335,5 +335,14 @@ public function testPersonCannotHaveMultipleParents()
$this->setExpectedException('LogicException', 'This person is already associated with another parent');
$parent2->addChild($this->person);
}

public function testGetChildren()
{
$parent1 = $this->getMockForAbstractClass('Opg\Core\Model\Entity\Person\Person');

$parent1->addChild($this->person);

$this->assertEquals($this->person, $parent1->getChildren()[0]);
}
}

Expand Up @@ -11,6 +11,7 @@

use Opg\Core\Model\Entity\CaseItem\Lpa\Party\Donor;
use Opg\Core\Model\Entity\PhoneNumber\PhoneNumber;
use Zend\InputFilter\InputFilter;

class PhoneNumberTest extends \PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -78,4 +79,11 @@ public function testGetSetDefault()
$this->phoneNumber->setDefault(true);
$this->assertTrue($this->phoneNumber->getDefault());
}

public function testGetInputFilter()
{
$this->assertTrue(
$this->phoneNumber->getInputFilter() instanceof InputFilter
);
}
}

0 comments on commit 73f7f50

Please sign in to comment.