コード例 #1
0
 /**
  * @test
  * @dataProvider customFieldDataProvider
  *
  * @param CustomField $customField
  */
 public function testUpdateCustomField($customField)
 {
     $customFieldApi = $this->getCustomFieldApi();
     $customField->setId('TestId');
     $originalCustomField = clone $customField;
     $returnedCustomField = $customField;
     $returnedCustomField->setName('Test Name');
     // init expected response
     $expectedResponse = new CloseIoResponse();
     $expectedResponse->setReturnCode('200');
     $expectedResponse->setRawData(json_encode($returnedCustomField));
     $expectedResponse->setData(json_decode($expectedResponse->getRawData(), true));
     // create stub
     $mockCurl = $this->getMockResponderCurl($expectedResponse);
     $customFieldApi->setCurl($mockCurl);
     /* @var CustomField $response */
     $response = $customFieldApi->updateCustomField($customField);
     $this->assertEquals($customField->getName(), $response->getName());
     $this->assertEquals($originalCustomField->getId(), $response->getId());
 }
コード例 #2
0
 /**
  * @throws \LooplineSystems\CloseIoApiWrapper\Library\Exception\InvalidParamException
  * @throws \LooplineSystems\CloseIoApiWrapper\Library\Exception\ResourceNotFoundException
  * @param Lead $lead
  * @dataProvider leadProvider
  */
 public function testUpdateLead($lead)
 {
     $leadsApi = $this->getLeadsApi();
     $lead->setId('TestId');
     $originalLead = clone $lead;
     $returnedLead = $lead;
     $returnedLead->setName('Test Name');
     // init expected response
     $expectedResponse = new CloseIoResponse();
     $expectedResponse->setReturnCode('200');
     $expectedResponse->setRawData(json_encode($returnedLead));
     $expectedResponse->setData(json_decode($expectedResponse->getRawData(), true));
     // create stub
     $mockCurl = $this->getMockResponderCurl($expectedResponse);
     $leadsApi->setCurl($mockCurl);
     /* @var Lead $response */
     $response = $leadsApi->updateLead($lead);
     $this->assertEquals($lead->getDescription(), $response->getDescription());
     $this->assertEquals($originalLead->getId(), $response->getId());
 }