Skip to content

Commit a68e4ea

Browse files
committed
add tests, update emulator versions
1 parent 5ebe756 commit a68e4ea

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

.github/workflows/emulator-system-tests-bigtable.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v5
2323

24-
- run: ./.github/emulator/start-emulator.sh bigtable 521.0.0-emulators
24+
- run: ./.github/emulator/start-emulator.sh bigtable 522.0.0-emulators
2525

2626
- name: Setup PHP
2727
uses: shivammathur/setup-php@v2

.github/workflows/emulator-system-tests-datastore.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v5
2323

24-
- run: ./.github/emulator/start-emulator.sh datastore 521.0.0-emulators
24+
- run: ./.github/emulator/start-emulator.sh datastore 522.0.0-emulators
2525

2626
- name: Setup PHP
2727
uses: shivammathur/setup-php@v2

Firestore/tests/System/ListenTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,39 @@ public function testListen()
4949
// Create a client.
5050
$firestoreClient = new FirestoreClient();
5151

52+
// Prepare the request message.
53+
$request = (new ListenRequest())
54+
->setDatabase($database);
55+
56+
// Call the API and handle any network failures.
57+
/** @var BidiStream $stream */
58+
$stream = $firestoreClient->listen([
59+
'headers' => [
60+
'x-goog-request-params' => [
61+
'database=' . $database
62+
]
63+
]
64+
]);
65+
$stream->writeAll([$request,]);
66+
67+
/** @var ListenResponse $element */
68+
foreach ($stream->closeWriteAndReadAll() as $element) {
69+
// TODO: Assert something
70+
}
71+
$this->assertTrue(true);
72+
}
73+
74+
public function testListenThrowsExceptionWithoutDatabaseHeader()
75+
{
76+
$this->expectException(ApiException::class);
77+
$this->expectExceptionMessage(
78+
'Missing required http header (\'google-cloud-resource-prefix\' or \'x-goog-request-params\') or query param \'database\'.'
79+
);
80+
$database = sprintf(self::DATABASE, $this->projectId);
81+
82+
// Create a client.
83+
$firestoreClient = new FirestoreClient();
84+
5285
// Prepare the request message.
5386
$request = (new ListenRequest())
5487
->setDatabase($database);

0 commit comments

Comments
 (0)