/** * Pre test set up */ public function setUp() { $this->reference = new ReferencingApplication(); $this->guarantorCreatorStub = $this->getMockBuilder('RRP\\Utility\\RrpGuarantorReferenceCreator')->disableOriginalConstructor()->getMock(); // Mock the chain: $reference->getDecisionDetails()->getRecommendation() $this->rrpReferenceMock = $this->getMock('RRP\\Model\\RentRecoveryPlusReference'); $this->decisionDetailsMock = $this->getMockBuilder('Barbondev\\IRISSDK\\IndividualApplication\\ReferencingApplication\\Model\\ReferencingDecisionDetails')->setMethods(array('getRecommendation'))->getMock(); $this->recommendationMock = $this->getMockBuilder('Barbondev\\IRISSDK\\Common\\Model\\Recommendation')->setMethods(array('getStatus'))->getMock(); $this->rrpReferenceMock->expects($this->once())->method('getDecisionDetails')->willReturn($this->decisionDetailsMock); $this->decisionDetailsMock->expects($this->once())->method('getRecommendation')->willReturn($this->recommendationMock); }
/** * Pre test set up. */ public function setUp() { $this->reference = new ReferencingApplication(); // Mock the following: $rrpReference->getDecisionDetails()->getCreditReference()->getScore() // Create the mocks, declaring the methods they will call $this->mockRrpReference = $this->getMockBuilder('RRP\\Model\\RentRecoveryPlusReference')->setMethods(array('getParent', 'getDecisionDetails'))->getMock(); $this->mockDecisionDetails = $this->getMockBuilder('Barbondev\\IRISSDK\\IndividualApplication\\ReferencingApplication\\Model\\ReferencingDecisionDetails')->setMethods(array('getCreditReference'))->getMock(); $this->mockCreditReference = $this->getMockBuilder('Barbondev\\IRISSDK\\Common\\Model\\CreditReference')->setMethods(array('getScore'))->getMock(); // Declare the results of their expected methods $this->mockRrpReference->expects($this->any())->method('getParent')->willReturn($this->reference); $this->mockRrpReference->expects($this->any())->method('getDecisionDetails')->willReturn($this->mockDecisionDetails); $this->mockDecisionDetails->expects($this->any())->method('getCreditReference')->willReturn($this->mockCreditReference); $this->insightCriteria = new InsightCriteriaGroup(new StatusCriteria(), new CreditScoreCriteria(), new AdverseCreditCriteria(), new EmploymentCriteria()); }