Skip to content

Commit 9af5fd7

Browse files
committed
Fixed tests; Fixed result dto when there are no prices/stores
1 parent a1fd865 commit 9af5fd7

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/DTOs/Google/ImmersiveProductResults.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77

88
class ImmersiveProductResults extends Data
99
{
10-
// reviews, rating, stores_next_page_token, ratings
1110
public function __construct(
12-
public readonly array $thumbnails,
13-
public readonly string $title,
14-
public readonly string $brand,
15-
public readonly string $price_range,
16-
public readonly ImmersiveProductAboutTheProduct $about_the_product,
11+
public readonly ?string $title = null,
12+
public readonly ?string $brand = null,
13+
public readonly ?string $price_range = null,
14+
public readonly ?ImmersiveProductAboutTheProduct $about_the_product = null,
15+
public readonly ?array $thumbnails = [],
1716
public readonly ?int $reviews = null,
1817
public readonly ?int $rating = null,
1918
public readonly ?string $stores_next_page_token = null,

tests/Feature/SerpApiClientTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class SerpApiClientTest extends BaseTest
1717
public function test_google_immersive_product()
1818
{
1919
Http::fake([
20-
'https://serpapi.com/search.json?engine=google_immersive_product&pageToken=asdf&api_key=tests' => Http::response($this->getFixtureJsonContent('google_immersive_product_response.json'), 200),
20+
'https://serpapi.com/search.json?engine=google_immersive_product&page_token=asdf&api_key=tests' => Http::response($this->getFixtureJsonContent('google_immersive_product_response.json'), 200),
2121
]);
2222

2323
$client = new SerpApiClient(apiKey: 'tests');
@@ -36,7 +36,7 @@ public function test_google_immersive_product()
3636
public function test_google_immersive_product_async()
3737
{
3838
Http::fake([
39-
'https://serpapi.com/search.json?engine=google_immersive_product&pageToken=asdf&api_key=tests' => Http::response($this->getFixtureJsonContent('google_immersive_product_response_async.json'), 200),
39+
'https://serpapi.com/search.json?engine=google_immersive_product&page_token=asdf&api_key=tests' => Http::response($this->getFixtureJsonContent('google_immersive_product_response_async.json'), 200),
4040
'https://serpapi.com/searches/68f12e7fcc56d34e74b53c3e.json?api_key=tests' => Http::response($this->getFixtureJsonContent('google_immersive_product_response.json'), 200),
4141
]);
4242

0 commit comments

Comments
 (0)