コード例 #1
0
 /**
  * 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);
 }
コード例 #2
0
 /**
  * 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());
 }
 /**
  * @test
  */
 public function gets_and_sets_the_decision_details_on_the_new_object()
 {
     $referenceFoundInSession = new ReferencingApplication();
     // Set up the necessary scenarios for finding a valid reference in the session...
     $this->mockSessionHolder->expects($this->once())->method('getReferenceFromSession')->willReturn($referenceFoundInSession);
     // And assert that 'getDecisionDetails' will be called on the $decisionDetailsRetriever...
     $this->mockDecisionDetailsRetriever->expects($this->once())->method('getDecisionDetails')->with($referenceFoundInSession)->willReturn(new ReferencingDecisionDetails());
     // And also assert that 'setDecisionDetails' will be called on the RentRecoveryPlusReference object.
     $this->mockRentRecoveryPlusReference->method('setParent')->will($this->returnSelf());
     $this->mockRentRecoveryPlusReference->expects($this->once())->method('setDecisionDetails');
     // Trigger the test
     $transformer = new ReferenceNumberToReferenceObjectTransformer($this->mockDecisionDetailsRetriever, $this->mockSessionHolder, $this->mockRentRecoveryPlusReference);
     $transformer->reverseTransform('HLT999');
 }