Skip to content

Commit 43413fc

Browse files
committed
Tests: Add opt-in checks for core abilities with live AI providers.
Exercise each core ability separately and together across the three providers. Keep the suite outside ordinary PHPUnit discovery so contributors can run it explicitly with their own credentials. Surface rejected schemas and failed ability calls. Developed in: #16029 Props jorgefilipecosta. Fixes #66707. git-svn-id: https://develop.svn.wordpress.org/trunk@65819 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 298ae13 commit 43413fc

5 files changed

Lines changed: 423 additions & 1 deletion

File tree

‎.env.example‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,19 @@ LOCAL_WP_ENVIRONMENT_TYPE=local
8484
LOCAL_WP_DEVELOPMENT_MODE=core
8585
LOCAL_WP_TESTS_DOMAIN=example.org
8686

87+
##
88+
# API keys and models for the live AI provider tests, which send real requests.
89+
# See `tests/phpunit/manual/wpAiClientLiveProviders.php`.
90+
##
91+
# WP_TESTS_AI_ANTHROPIC_API_KEY=
92+
# WP_TESTS_AI_GOOGLE_API_KEY=
93+
# WP_TESTS_AI_OPENAI_API_KEY=
94+
#
95+
# Model IDs to use instead of the default models, such as `gemini-3.5-flash-lite`.
96+
# WP_TESTS_AI_ANTHROPIC_MODEL=
97+
# WP_TESTS_AI_GOOGLE_MODEL=
98+
# WP_TESTS_AI_OPENAI_MODEL=
99+
87100
##
88101
# This silences the tips output by the dotenv package.
89102
##

‎composer.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@
5555
"phpstan/phpstan": "2.3.7",
5656
"phpstan/phpstan-phpunit": "2.1.2",
5757
"phpstan/phpstan-strict-rules": "2.1.2",
58-
"yoast/phpunit-polyfills": "^1.1.0"
58+
"yoast/phpunit-polyfills": "^1.1.0",
59+
"wordpress/ai-provider-for-anthropic": "1.0.5",
60+
"wordpress/ai-provider-for-google": "1.3.0",
61+
"wordpress/ai-provider-for-openai": "1.3.0"
5962
},
6063
"config": {
6164
"audit": { "ignore": [ "GHSA-hmqg-cxww-wqhq", "PKSA-rdkp-vv9z-mjkg" ] },

‎docker-compose.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ services:
4949
GITHUB_REF: ${GITHUB_REF-false}
5050
GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME-false}
5151
HOST_PATH: ${PWD-}/${LOCAL_DIR-src}
52+
# Passed through for the live AI provider tests, and only when they are set.
53+
WP_TESTS_AI_ANTHROPIC_API_KEY:
54+
WP_TESTS_AI_GOOGLE_API_KEY:
55+
WP_TESTS_AI_OPENAI_API_KEY:
56+
WP_TESTS_AI_ANTHROPIC_MODEL:
57+
WP_TESTS_AI_GOOGLE_MODEL:
58+
WP_TESTS_AI_OPENAI_MODEL:
5259

5360
volumes:
5461
- ./tools/local-env/php-config.ini:/usr/local/etc/php/conf.d/php-config.ini

0 commit comments

Comments
 (0)