-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathExampleSearchGoogleEventsTest.php
More file actions
45 lines (37 loc) · 1.06 KB
/
Copy pathExampleSearchGoogleEventsTest.php
File metadata and controls
45 lines (37 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace SerpApi\Tests;
use SerpApi\SerpApiException;
class ExampleSearchGoogleEventsTest extends SerpApiTestCase
{
/** @var array<string, string> */
private $searchParams;
protected function setUp(): void
{
parent::setUp();
$this->searchParams = [
'engine' => 'google_events',
'q' => 'Events in Austin',
'location' => 'Austin, Texas, United States',
];
}
public function testResultExists()
{
$client = $this->serpApiClient();
// Temporary fix for google_events engine being unavailable
try {
$response = $client->search($this->searchParams);
} catch (SerpApiException $e) {
$this->markTestSkipped(
'google_events is currently unavailable: ' . ($e->getSerpApiError() ?? $e->getMessage())
);
}
if (!property_exists($response, 'events_results')) {
$this->markTestSkipped('google_events returned no events_results');
}
$this->assertResponseHasProperty(
$response,
'events_results',
'Error on `google_events` engine: no `events_results`'
);
}
}