Skip to content

test(Firestore): stop warnings in the update-paths conformance test - #9773

Open
rootkiller6788 wants to merge 1 commit into
googleapis:mainfrom
rootkiller6788:fix-firestore-updatepaths-conformance-warning
Open

rootkiller6788 wants to merge 1 commit into
googleapis:mainfrom
rootkiller6788:fix-firestore-updatepaths-conformance-warning

Conversation

@rootkiller6788

Copy link
Copy Markdown

Fixes #9100.

testUpdatePaths() loops over $test['fieldPaths'], but the update-paths: no paths case doesn't have that key - it only carries docRefPath and isError. That gave two warnings on every run:

PHP Warning:  Undefined array key "fieldPaths" in .../ConformanceTest.php on line 193
PHP Warning:  foreach() argument must be of type array|object, null given in .../ConformanceTest.php on line 193

I used ?? [] so the case still runs and update() gets called with an empty list, which is what that case is actually about - its own comment says "It is a client-side error to call Update with empty data."

One thing worth knowing: the test was already green. executeAndHandleError() catches \Exception, and PHPUnit turns the warning into PHPUnit\Framework\Error\Warning, which extends \Exception - so the warning itself was being counted as the expected error, and the assertion wasn't really checking anything. Now the exception comes from the client's own empty-data check instead.

Ran vendor/bin/phpunit under Firestore/ with PHP 8.4.25 and grpc 1.84.0: 723 tests, 2758 assertions, OK (13 skipped), same as before the change.

The 'update-paths: no paths' conformance case has no fieldPaths key, so
the foreach in testUpdatePaths() warned twice on every run. Pass an
empty list instead, which also means update() actually gets called with
no data - the case expects a client-side error there.
@product-auto-label product-auto-label Bot added the api: firestore Issues related to the Firestore API. label Oct 7, 2026
@rootkiller6788
rootkiller6788 marked this pull request as ready for review October 7, 2026 04:24
@rootkiller6788
rootkiller6788 requested review from a team as code owners October 7, 2026 04:24

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: firestore Issues related to the Firestore API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Firestore] Warnings in ConformanceTest.php

1 participant