Problem/Motivation
The current functional test depends on real Google credentials and a real spreadsheet via GOOGLE_SERVICE_ACCOUNT_KEY and GOOGLE_SHEETS_SPREADSHEET_URL: WebformGoogleSheetsTest.php (line 46). If those env vars are missing, the test is skipped. Even when it runs, it mainly confirms that a success log entry was written, not that handler data shaping or request construction is correct.
Proposed resolution
Add deterministic tests that do not call Google’s API. Cover the handler logic using local Webform submissions, Google model objects, and/or a test subclass exposing protected helper methods.
Suggested coverage
prepareCell() handles strings, numbers, booleans, empty/null values.
prepareRequest() appends columns when row width exceeds sheet column count.
prepareRequest() passes rows as an array.
getData() flattens normal fields, composites, empty composites, multivalue fields, comma-separated values, and timestamps.
Existing live Google functional test can remain as optional integration coverage.
Acceptance criteria
New tests run without Google credentials.
No real network/API call is required.
Existing functional test remains available for integration testing.
Coverage targets handler behavior, not just watchdog output.
Issue fork webform_googlesheets-3607295
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
elamanComment #4
nitinkumar_7 commentedReviewed the MR. its good that these dont touch the network at all : mocked webform/submission/element manager, so they'll actually run in CI instead of getting skipped like the old one always was.
One case I'd want added if it's missing: a row where literally everything is empty or null, not just one composite. Want to make sure the request we build in that scenario wouldn't just get rejected by Google's API outright.
One more thing Im curious about: why the pipeline tests failed , I'll investigate & fix the issues.
Comment #5
elaman