Add PHPUnit test coverage for GeminiProvider
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3572948. --> Reported by: [jibla](https://www.drupal.org/user/1013184) Related to !26 >>> <p>[Tracker]<br> <strong>Update Summary: </strong>New - adding test infrastructure<br> <strong>Check-in Date: </strong>02/11/2026<br> <strong>Additional Collaborators: </strong><br> <em>Metadata is used by the <a href="https://www.drupalstarforge.ai/" title="AI Tracker">AI Tracker.</a> Docs and additional fields <a href="https://www.drupalstarforge.ai/ai-dashboard/docs" title="AI Issue Tracker Documentation">here</a>.</em><br> [/Tracker]</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>The gemini_provider module currently has zero automated test coverage. As we prepare for a stable release and plan to add new operation types (TTS, text-to-image, STT), we need a test foundation to prevent regressions.</p> <p>The AI module provides <code>AiProviderTestBase</code>, a kernel test base class specifically designed for testing providers. We should leverage this to cover all existing functionality.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Add PHPUnit tests covering:</p> <p><strong>Kernel tests (extending AiProviderTestBase):</strong></p> <ul> <li>Chat: basic request/response, streaming, image vision, structured JSON output, tool/function calling</li> <li>Embeddings: basic text embeddings, vector size verification per model</li> <li>Error handling: missing API key, invalid model, unsupported role</li> <li>Provider discovery: <code>isUsable()</code>, <code>getSupportedOperationTypes()</code>, <code>getConfiguredModels()</code></li> </ul> <p><strong>Unit tests:</strong></p> <ul> <li><code>convertJsonSchemaToGeminiSchema()</code> &mdash; OpenAI-to-Gemini schema conversion</li> <li><code>buildGeminiSchemaFromArray()</code> &mdash; recursive schema building</li> <li>Configuration handling (stopSequences splitting, topK casting)</li> </ul> <h3 id="summary-remaining-tasks">Target date or deadline</h3> <p>Before stable release.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <ul> <li>Create test directory structure (<code>tests/src/Kernel/</code>, <code>tests/src/Unit/</code>)</li> <li>Write kernel tests for chat operations</li> <li>Write kernel tests for embeddings operations</li> <li>Write unit tests for schema conversion</li> <li>Write unit tests for configuration handling</li> <li>Ensure all tests pass with <code>ddev phpunit</code></li> <li>Ensure phpcs clean</li> </ul> <h3 id="summary-ai-usage">AI usage (if applicable)</h3> <p>[x] AI Assisted Issue<br> This issue was generated with AI assistance, but was reviewed and refined by the creator.</p> <p>[ ] AI Assisted Code</p> <p>[ ] AI Generated Code</p> <p>[ ] Vibe Coded</p> > Related issue: [Issue #3572958](https://www.drupal.org/node/3572958)
issue