-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from commercetools/gen-sdk-updates
- Loading branch information
Showing
7,077 changed files
with
165,097 additions
and
6,679 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
513 changes: 513 additions & 0 deletions
513
...cetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyBusinessUnitsByIDTest.php
Large diffs are not rendered by default.
Oops, something went wrong.
513 changes: 513 additions & 0 deletions
513
...ols-api-tests/test/unit/Client/Resource/ResourceByProjectKeyBusinessUnitsKeyByKeyTest.php
Large diffs are not rendered by default.
Oops, something went wrong.
433 changes: 433 additions & 0 deletions
433
...mmercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyBusinessUnitsTest.php
Large diffs are not rendered by default.
Oops, something went wrong.
157 changes: 157 additions & 0 deletions
157
...Client/Resource/ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file has been auto generated | ||
* Do not change it. | ||
*/ | ||
|
||
namespace Commercetools\Api\Test\Client\Resource; | ||
|
||
use Commercetools\Api\Client\ApiRequestBuilder; | ||
use Commercetools\Base\JsonObject; | ||
use Commercetools\Client\ApiRequest; | ||
use Commercetools\Exception\ApiClientException; | ||
use Commercetools\Exception\ApiServerException; | ||
use GuzzleHttp\ClientInterface; | ||
use GuzzleHttp\Exception\ClientException; | ||
use GuzzleHttp\Exception\ServerException; | ||
use GuzzleHttp\Psr7\Response; | ||
use PHPUnit\Framework\TestCase; | ||
use Psr\Http\Message\RequestInterface; | ||
|
||
/** | ||
* @covers \Commercetools\Api\Client\Resource\ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersPost | ||
* @covers \Commercetools\Api\Client\Resource\ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomers | ||
*/ | ||
class ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersTest extends TestCase | ||
{ | ||
/** | ||
* @dataProvider getRequests() | ||
*/ | ||
public function testBuilder(callable $builderFunction, string $method, string $relativeUri, string $body = null) | ||
{ | ||
$builder = new ApiRequestBuilder(); | ||
$request = $builderFunction($builder); | ||
$this->assertSame(strtolower($method), strtolower($request->getMethod())); | ||
$this->assertSame($relativeUri, (string) $request->getUri()); | ||
if (!is_null($body)) { | ||
$this->assertJsonStringEqualsJsonString($body, (string) $request->getBody()); | ||
} else { | ||
$this->assertSame("", (string) $request->getBody()); | ||
} | ||
} | ||
|
||
|
||
|
||
/** | ||
* @dataProvider getRequestBuilderResponses() | ||
*/ | ||
public function testMapFromResponse(callable $builderFunction, $statusCode) | ||
{ | ||
$builder = new ApiRequestBuilder(); | ||
$request = $builderFunction($builder); | ||
$this->assertInstanceOf(ApiRequest::class, $request); | ||
|
||
$response = new Response($statusCode, [], "{}"); | ||
$this->assertInstanceOf(JsonObject::class, $request->mapFromResponse($response)); | ||
} | ||
|
||
/** | ||
* @dataProvider getRequestBuilders() | ||
*/ | ||
public function testExecuteClientException(callable $builderFunction) | ||
{ | ||
$client = $this->createMock(ClientInterface::class); | ||
|
||
$builder = new ApiRequestBuilder($client); | ||
$request = $builderFunction($builder); | ||
$client->method("send")->willThrowException(new ClientException("Oops!", $request, new Response(400))); | ||
|
||
$this->expectException(ApiClientException::class); | ||
$request->execute(); | ||
} | ||
|
||
/** | ||
* @dataProvider getRequestBuilders() | ||
*/ | ||
public function testExecuteServerException(callable $builderFunction) | ||
{ | ||
$client = $this->createMock(ClientInterface::class); | ||
|
||
$builder = new ApiRequestBuilder($client); | ||
$request = $builderFunction($builder); | ||
$client->method("send")->willThrowException(new ServerException("Oops!", $request, new Response(500))); | ||
|
||
$this->expectException(ApiServerException::class); | ||
$request->execute(); | ||
} | ||
|
||
public function getRequests() | ||
{ | ||
return [ | ||
'ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersPost' => [ | ||
function (ApiRequestBuilder $builder): RequestInterface { | ||
return $builder | ||
->withProjectKey("test_projectKey") | ||
->inBusinessUnitKeyWithBusinessUnitKeyValue("test_businessUnitKey") | ||
->me() | ||
->customers() | ||
->post(null); | ||
}, | ||
'post', | ||
'test_projectKey/in-business-unit/key=test_businessUnitKey/me/customers', | ||
] | ||
]; | ||
} | ||
|
||
public function getResources() | ||
{ | ||
return [ | ||
]; | ||
} | ||
|
||
public function getRequestBuilders() | ||
{ | ||
return [ | ||
'ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersPost' => [ | ||
function (ApiRequestBuilder $builder): RequestInterface { | ||
return $builder | ||
->withProjectKey("projectKey") | ||
->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey") | ||
->me() | ||
->customers() | ||
->post(null); | ||
} | ||
] | ||
]; | ||
} | ||
|
||
public function getRequestBuilderResponses() | ||
{ | ||
return [ | ||
'ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersPost_201' => [ | ||
function (ApiRequestBuilder $builder): RequestInterface { | ||
return $builder | ||
->withProjectKey("projectKey") | ||
->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey") | ||
->me() | ||
->customers() | ||
->post(null); | ||
}, | ||
201 | ||
], | ||
'ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersPost_599' => [ | ||
function (ApiRequestBuilder $builder): RequestInterface { | ||
return $builder | ||
->withProjectKey("projectKey") | ||
->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey") | ||
->me() | ||
->customers() | ||
->post(null); | ||
}, | ||
599 | ||
] | ||
]; | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
...est/unit/Client/Resource/ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file has been auto generated | ||
* Do not change it. | ||
*/ | ||
|
||
namespace Commercetools\Api\Test\Client\Resource; | ||
|
||
use Commercetools\Api\Client\ApiRequestBuilder; | ||
use Commercetools\Api\Client\Resource\ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomers; | ||
use Commercetools\Base\JsonObject; | ||
use Commercetools\Client\ApiRequest; | ||
use Commercetools\Exception\ApiClientException; | ||
use Commercetools\Exception\ApiServerException; | ||
use GuzzleHttp\ClientInterface; | ||
use GuzzleHttp\Exception\ClientException; | ||
use GuzzleHttp\Exception\ServerException; | ||
use GuzzleHttp\Psr7\Response; | ||
use PHPUnit\Framework\TestCase; | ||
use Psr\Http\Message\RequestInterface; | ||
|
||
/** | ||
* @covers \Commercetools\Api\Client\Resource\ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMe | ||
*/ | ||
class ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeTest extends TestCase | ||
{ | ||
/** | ||
* @dataProvider getResources() | ||
*/ | ||
public function testResources(callable $builderFunction, string $class, array $expectedArgs) | ||
{ | ||
$builder = new ApiRequestBuilder(); | ||
$resource = $builderFunction($builder); | ||
$this->assertInstanceOf($class, $resource); | ||
$this->assertEquals($expectedArgs, $resource->getArgs()); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
public function getRequests() | ||
{ | ||
return [ | ||
]; | ||
} | ||
|
||
public function getResources() | ||
{ | ||
return [ | ||
'ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomers' => [ | ||
function (ApiRequestBuilder $builder): ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomers { | ||
return $builder | ||
->withProjectKey("test_projectKey") | ||
->inBusinessUnitKeyWithBusinessUnitKeyValue("test_businessUnitKey") | ||
->me() | ||
->customers(); | ||
}, | ||
ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomers::class, | ||
['projectKey' => 'test_projectKey', 'businessUnitKey' => 'test_businessUnitKey'], | ||
'/{projectKey}/in-business-unit/key={businessUnitKey}/me/customers' | ||
] | ||
]; | ||
} | ||
|
||
public function getRequestBuilders() | ||
{ | ||
return [ | ||
]; | ||
} | ||
|
||
public function getRequestBuilderResponses() | ||
{ | ||
return [ | ||
]; | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
.../test/unit/Client/Resource/ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file has been auto generated | ||
* Do not change it. | ||
*/ | ||
|
||
namespace Commercetools\Api\Test\Client\Resource; | ||
|
||
use Commercetools\Api\Client\ApiRequestBuilder; | ||
use Commercetools\Api\Client\Resource\ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMe; | ||
use Commercetools\Base\JsonObject; | ||
use Commercetools\Client\ApiRequest; | ||
use Commercetools\Exception\ApiClientException; | ||
use Commercetools\Exception\ApiServerException; | ||
use GuzzleHttp\ClientInterface; | ||
use GuzzleHttp\Exception\ClientException; | ||
use GuzzleHttp\Exception\ServerException; | ||
use GuzzleHttp\Psr7\Response; | ||
use PHPUnit\Framework\TestCase; | ||
use Psr\Http\Message\RequestInterface; | ||
|
||
/** | ||
* @covers \Commercetools\Api\Client\Resource\ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKey | ||
*/ | ||
class ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyTest extends TestCase | ||
{ | ||
/** | ||
* @dataProvider getResources() | ||
*/ | ||
public function testResources(callable $builderFunction, string $class, array $expectedArgs) | ||
{ | ||
$builder = new ApiRequestBuilder(); | ||
$resource = $builderFunction($builder); | ||
$this->assertInstanceOf($class, $resource); | ||
$this->assertEquals($expectedArgs, $resource->getArgs()); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
public function getRequests() | ||
{ | ||
return [ | ||
]; | ||
} | ||
|
||
public function getResources() | ||
{ | ||
return [ | ||
'ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMe' => [ | ||
function (ApiRequestBuilder $builder): ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMe { | ||
return $builder | ||
->withProjectKey("test_projectKey") | ||
->inBusinessUnitKeyWithBusinessUnitKeyValue("test_businessUnitKey") | ||
->me(); | ||
}, | ||
ResourceByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMe::class, | ||
['projectKey' => 'test_projectKey', 'businessUnitKey' => 'test_businessUnitKey'], | ||
'/{projectKey}/in-business-unit/key={businessUnitKey}/me' | ||
] | ||
]; | ||
} | ||
|
||
public function getRequestBuilders() | ||
{ | ||
return [ | ||
]; | ||
} | ||
|
||
public function getRequestBuilderResponses() | ||
{ | ||
return [ | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.