Skip to content

Commit

Permalink
Merge pull request #17 from andrei-ghenov/feature/T-004-product-api-i…
Browse files Browse the repository at this point in the history
…ntegration

Feature/t 004 product api integration
  • Loading branch information
andrei-ghenov authored Mar 4, 2024
2 parents b872846 + 269cae1 commit f6c1cfc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"scripts": {
"test-api-client": "vendor/bin/phpunit tests/Api/ApiClientTest.php",
"test-service-product": "vendor/bin/phpunit tests/Service/ProductServiceTest.php",
"test-service-purchase": "vendor/bin/phpunit tests/Service/PurchaseServiceTest.php",
"test-service-status_check": "vendor/bin/phpunit tests/Service/StatusCheckServiceTest.php"
}
Expand Down
21 changes: 14 additions & 7 deletions tests/Service/ProductServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ class ProductServiceTest extends TestCase {
*/
private $apiProductID;

/**
* Test the getAllProducts method.
*/
public function testGetAllProducts() {

// Attempt to fetch all products.
$product = $this->productService->getAllProducts();

// Display the response for debugging purposes.
echo "testGetAllProducts Response: ";
var_dump($product);
}

/**
* Test the getProductById method.
*/
Expand All @@ -37,14 +50,8 @@ public function testGetProductById() {
$product = $this->productService->getProductById($this->apiProductID);

// Display the response for debugging purposes.
echo "Response: ";
echo "testGetProductById Response: ";
var_dump($product);

// You might want to adjust these assertions based on
// the expected product structure.
$this->assertIsArray($product);
$this->assertArrayHasKey('Product', $product);
$this->assertEquals($this->apiProductID , $product['Product']);
}

/**
Expand Down

0 comments on commit f6c1cfc

Please sign in to comment.