Skip to content

Commit

Permalink
T-004: Add testGetAllProducts method to ProductServiceTest
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-ghenov committed Mar 4, 2024
1 parent 86f62ea commit 269cae1
Showing 1 changed file with 14 additions and 7 deletions.
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 269cae1

Please sign in to comment.