Skip to content

Commit

Permalink
Added unused tests
Browse files Browse the repository at this point in the history
  • Loading branch information
L3RAZ committed Apr 5, 2024
1 parent 1966e40 commit 93c52f9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
6 changes: 3 additions & 3 deletions tests/Unit/PaymentService/PaymentServiceCreateOrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PaymentServiceCreateOrderTest extends TestCase
*/
public function testInvalidRequestErrorsCreateOrder($errorName, $errorCode)
{
// $this->handleTestErrorsCreateOrder(400, $errorName, $errorCode);
$this->handleTestErrorsCreateOrder(400, $errorName, $errorCode);
}

/**
Expand All @@ -34,7 +34,7 @@ public function testInvalidRequestErrorsCreateOrder($errorName, $errorCode)
*/
public function testNotAuthorizedErrorsCreateOrder($errorName, $errorCode)
{
// $this->handleTestErrorsCreateOrder(401, $errorName, $errorCode);
$this->handleTestErrorsCreateOrder(401, $errorName, $errorCode);
}

/**
Expand All @@ -44,7 +44,7 @@ public function testNotAuthorizedErrorsCreateOrder($errorName, $errorCode)
*/
public function testUnprocessableEntityErrorsCreateOrder($errorName, $errorCode)
{
// $this->handleTestErrorsCreateOrder(422, $errorName, $errorCode);
$this->handleTestErrorsCreateOrder(422, $errorName, $errorCode);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/PaymentService/PaymentServiceGetOrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PaymentServiceGetOrderTest extends TestCase
*/
public function testNotAuthorizedErrorsGetOrder($errorName, $errorCode)
{
// $this->handleErrorsGetOrder(401, $errorName, $errorCode);
$this->handleErrorsGetOrder(401, $errorName, $errorCode);
}

/**
Expand Down Expand Up @@ -54,9 +54,9 @@ private function handleErrorsGetOrder($statusCode, $errorName, $errorCode)
$clientMock = $this->createMock(CheckoutHttpClient::class);
$clientMock->method('fetchOrder')->willThrowException(new HttpException('An error occurred', $requestMock, $responseMock));

// $this->expectExceptionCode($errorCode);
// $paymentService = new PaymentService($clientMock, new ObjectSerializer());
// $paymentService->getOrder('LUX8l091NV');
$this->expectExceptionCode($errorCode);
$paymentService = new PaymentService($clientMock, new ObjectSerializer());
$paymentService->getOrder('LUX8l091NV');
}

private function getNotAuthorizedError($issueError)
Expand Down
12 changes: 6 additions & 6 deletions tests/Unit/PaymentService/PaymentServiceUpdateOrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PaymentServiceUpdateOrderTest extends TestCase
*/
public function testInvalidRequestErrorsUpdateOrder($errorName, $errorCode)
{
// $this->handleErrorsUpdateOrder(400, $errorName, $errorCode);
$this->handleErrorsUpdateOrder(400, $errorName, $errorCode);
}

/**
Expand All @@ -35,7 +35,7 @@ public function testInvalidRequestErrorsUpdateOrder($errorName, $errorCode)
*/
public function testNotAuthorizedErrorsUpdateOrder($errorName, $errorCode)
{
// $this->handleErrorsUpdateOrder(401, $errorName, $errorCode);
$this->handleErrorsUpdateOrder(401, $errorName, $errorCode);
}

/**
Expand All @@ -45,7 +45,7 @@ public function testNotAuthorizedErrorsUpdateOrder($errorName, $errorCode)
*/
public function testUnprocessableEntityErrorsUpdateOrder($errorName, $errorCode)
{
// $this->handleErrorsUpdateOrder(422, $errorName, $errorCode);
$this->handleErrorsUpdateOrder(422, $errorName, $errorCode);
}

/**
Expand Down Expand Up @@ -83,9 +83,9 @@ private function handleErrorsUpdateOrder($statusCode, $errorName, $errorCode)
$clientMock = $this->createMock(CheckoutHttpClient::class);
$clientMock->method('updateOrder')->willThrowException(new HttpException('An error occurred', $requestMock, $responseMock));

// $this->expectExceptionCode($errorCode);
// $paymentService = new PaymentService($clientMock, new ObjectSerializer());
// $paymentService->updateOrder($updateRequestMock);
$this->expectExceptionCode($errorCode);
$paymentService = new PaymentService($clientMock, new ObjectSerializer());
$paymentService->updateOrder($updateRequestMock);
}

private function getInvalidRequestError($issueError)
Expand Down
28 changes: 14 additions & 14 deletions tests/Unit/Serializer/ObjectSerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
use PrestaShop\Module\PrestashopCheckout\PayPal\Order\DTO\PaymentSourceResponse;
use PrestaShop\Module\PrestashopCheckout\Serializer\ObjectSerializer;

//use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Encoder\JsonEncoder;

class ObjectSerializerTest extends TestCase
{
Expand All @@ -40,61 +40,61 @@ class ObjectSerializerTest extends TestCase
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
// $this->serializer = new ObjectSerializer();
$this->serializer = new ObjectSerializer();
}

/**
* @dataProvider objectProvider
*/
public function testSerializeWithoutEmptyValues($object, $expectedJson)
{
// $json = $this->serializer->serialize($object, JsonEncoder::FORMAT, true);
// $this->assertEquals($expectedJson, $json);
$json = $this->serializer->serialize($object, JsonEncoder::FORMAT, true);
$this->assertEquals($expectedJson, $json);
}

/**
* @dataProvider objectWithEmptyValuesProvider
*/
public function testSerializeWithEmptyValues($object, $expectedJson)
{
// $json = $this->serializer->serialize($object, JsonEncoder::FORMAT);
// $this->assertEquals($expectedJson, $json);
$json = $this->serializer->serialize($object, JsonEncoder::FORMAT);
$this->assertEquals($expectedJson, $json);
}

/**
* @dataProvider objectProvider
*/
public function testDeserialize($expectedObject, $json)
{
// $newObject = $this->serializer->deserialize($json, FundingSourceEntity::class, JsonEncoder::FORMAT);
// $this->assertEquals($expectedObject, $newObject);
$newObject = $this->serializer->deserialize($json, FundingSourceEntity::class, JsonEncoder::FORMAT);
$this->assertEquals($expectedObject, $newObject);
}

/**
* @dataProvider createPayPalOrderResponseSerializeObjectProvider
*/
public function testSerializePayPalOrderResponse($object, $expectedJson)
{
// $json = $this->serializer->serialize($object, JsonEncoder::FORMAT, true, true);
// $this->assertEquals($expectedJson, $json);
$json = $this->serializer->serialize($object, JsonEncoder::FORMAT, true, true);
$this->assertEquals($expectedJson, $json);
}

/**
* @dataProvider createPayPalOrderResponseDeserializeObjectProvider
*/
public function testDeserializePayPalOrderResponse($expectedObject, $json)
{
// $newObject = $this->serializer->deserialize($json, CreatePayPalOrderResponse::class, JsonEncoder::FORMAT);
// $this->assertEquals($expectedObject, $newObject);
$newObject = $this->serializer->deserialize($json, CreatePayPalOrderResponse::class, JsonEncoder::FORMAT);
$this->assertEquals($expectedObject, $newObject);
}

/**
* @dataProvider arrayProvider
*/
public function testToArray($object, $expectedArray, $skipNullValues, $convertToSnakeCase)
{
// $newArray = $this->serializer->toArray($object, $skipNullValues, $convertToSnakeCase);
// $this->assertEquals($expectedArray, $newArray);
$newArray = $this->serializer->toArray($object, $skipNullValues, $convertToSnakeCase);
$this->assertEquals($expectedArray, $newArray);
}

public function objectProvider()
Expand Down

0 comments on commit 93c52f9

Please sign in to comment.