|
20 | 20 | use Google\Cloud\Firestore\FirestoreClient; |
21 | 21 | use Google\Cloud\TestUtils\TestTrait; |
22 | 22 | use Google\Cloud\TestUtils\ExecuteCommandTrait; |
| 23 | +use Google\Cloud\Core\Exception\BadRequestException; |
23 | 24 | use PHPUnit\Framework\TestCase; |
24 | 25 |
|
25 | 26 | /** |
@@ -246,7 +247,11 @@ public function testRangeQuery() |
246 | 247 | */ |
247 | 248 | public function testInvalidRangeQuery() |
248 | 249 | { |
249 | | - $output = $this->runFirestoreCommand('invalid-range-query'); |
| 250 | + $this->expectException(BadRequestException::class); |
| 251 | + $this->expectExceptionMessage( |
| 252 | + 'Cannot have inequality filters on multiple properties' |
| 253 | + ); |
| 254 | + $this->runFirestoreCommand('invalid-range-query'); |
250 | 255 | } |
251 | 256 |
|
252 | 257 | /** |
@@ -426,27 +431,35 @@ public function testRangeOrderByQuery() |
426 | 431 | */ |
427 | 432 | public function testInvalidRangeOrderByQuery() |
428 | 433 | { |
429 | | - $output = $this->runFirestoreCommand('invalid-range-order-by-query'); |
| 434 | + $this->expectException(BadRequestException::class); |
| 435 | + $this->expectExceptionMessage( |
| 436 | + 'inequality filter property and first sort order must be the same' |
| 437 | + ); |
| 438 | + $this->runFirestoreCommand('invalid-range-order-by-query'); |
430 | 439 | } |
431 | 440 |
|
432 | 441 | public function testDocumentRef() |
433 | 442 | { |
434 | 443 | $output = $this->runFirestoreCommand('document-ref'); |
| 444 | + $this->assertContains('Retrieved document: ', $output); |
435 | 445 | } |
436 | 446 |
|
437 | 447 | public function testCollectionRef() |
438 | 448 | { |
439 | 449 | $output = $this->runFirestoreCommand('collection-ref'); |
| 450 | + $this->assertContains('Retrieved collection: ', $output); |
440 | 451 | } |
441 | 452 |
|
442 | 453 | public function testDocumentPathRef() |
443 | 454 | { |
444 | 455 | $output = $this->runFirestoreCommand('document-path-ref'); |
| 456 | + $this->assertContains('Retrieved document from path: ', $output); |
445 | 457 | } |
446 | 458 |
|
447 | 459 | public function testSubcollectionRef() |
448 | 460 | { |
449 | 461 | $output = $this->runFirestoreCommand('subcollection-ref'); |
| 462 | + $this->assertContains('Retrieved document from subcollection: ', $output); |
450 | 463 | } |
451 | 464 |
|
452 | 465 | /** |
@@ -568,6 +581,7 @@ public function testPaginatedQueryCursor() |
568 | 581 | public function testMultipleCursorConditions() |
569 | 582 | { |
570 | 583 | $output = $this->runFirestoreCommand('multiple-cursor-conditions'); |
| 584 | + $this->assertContains('Document TOK returned by start at ', $output); |
571 | 585 | } |
572 | 586 |
|
573 | 587 | private static function runFirestoreCommand($commandName) |
|
0 commit comments