/**
  * @param string $licenseId
  * @return LicenseInformation
  */
 public function getLicenseInformation($licenseId)
 {
     $apiLicenseInformation = $this->connection->sendRequest('getLicense', ['licenseId' => $licenseId]);
     $licenseInformation = new LicenseInformation();
     $licenseInformation->host = $apiLicenseInformation->host;
     $licenseInformation->customerName = $apiLicenseInformation->customer_name;
     $licenseInformation->email = $apiLicenseInformation->email;
     $licenseInformation->dateStart = $apiLicenseInformation->date_start;
     $licenseInformation->dateEnd = $apiLicenseInformation->date_end;
     $licenseInformation->type = $apiLicenseInformation->type;
     $licenseInformation->version = $apiLicenseInformation->version;
     $licenseInformation->packageName = $apiLicenseInformation->package_name;
     $licenseInformation->periodInMonths = $apiLicenseInformation->period_months;
     $licenseInformation->periodName = $apiLicenseInformation->period_name;
     $licenseInformation->limits = $apiLicenseInformation->limits;
     return $licenseInformation;
 }
 /**
  * @test
  */
 public function shouldReturnResultWhenRequestingLicenseInformation()
 {
     $this->connectionMock->shouldReceive('sendRequest')->withArgs(['getLicense', ['licenseId' => 'license-id']])->andReturn((object) ['host' => 'host', 'customer_name' => 'customer', 'email' => '*****@*****.**', 'date_start' => 'dateStart', 'date_end' => 'dateEnd', 'type' => 1, 'version' => 'version', 'package_name' => 'packageName', 'period_months' => 10, 'period_name' => 'period', 'limits' => ['something']])->once();
     $licenseInformation = $this->dreamCommerceClient->getLicenseInformation('license-id');
     $this->assertInstanceOf('DreamCommerce\\LicenseManager\\Dto\\LicenseInformation', $licenseInformation);
     $this->assertSame('*****@*****.**', $licenseInformation->email);
     $this->assertSame('host', $licenseInformation->host);
     $this->assertSame('customer', $licenseInformation->customerName);
     $this->assertSame('dateStart', $licenseInformation->dateStart);
     $this->assertSame('dateEnd', $licenseInformation->dateEnd);
     $this->assertSame(1, $licenseInformation->type);
     $this->assertSame('version', $licenseInformation->version);
     $this->assertSame('packageName', $licenseInformation->packageName);
     $this->assertSame(10, $licenseInformation->periodInMonths);
     $this->assertSame('period', $licenseInformation->periodName);
     $this->assertSame(['something'], $licenseInformation->limits);
 }
 /**
  * @test
  */
 public function shouldDecodeResponse()
 {
     $httpClient = new Client();
     $errorResponseMock = new Mock([new Response(200, [], Stream::factory('{}')), new Response(200, [], Stream::factory('{"foo":"bar"}'))]);
     $httpClient->getEmitter()->attach($errorResponseMock);
     $connection = new ApiConnection($httpClient, 'apiUrl', 'login', 'password');
     $expectedResult = new stdClass();
     $expectedResult->foo = 'bar';
     $this->assertEquals($expectedResult, $connection->sendRequest('fooMethod', []));
 }