feat(php): PHPUnit and Composer support and a PHP interpreter setting (#959)

Composer projects and PHPUnit suites are detected (Composer scripts, PHPUnit, artisan serve); PHPUnit runs report into the test tree through --teamcity with gutter runs for classes and methods, file-level runs, rerun failed and a PHPUnit run configuration type. Settings › Languages & Frameworks › PHP selects the CLI interpreter (discovered on PATH, Homebrew, phpbrew, phpenv, Herd, XAMPP, Laragon); it is applied to run configurations and PHP language servers through PATH. TeamCity service messages feed only the test tree and are kept out of the run console, sharing the stdout decoder go test -json uses.

Co-authored-by: ravuthz <[email protected]>
Цей коміт міститься в:
Ravuthzтаravuthz authored and GitHub committed 2026-11-03 23:17:52 +08:00
1 джерело d6efea8dac
коміт 9100187fc8
27 files changed
+925 -41

No files matched your search

+4
Переглянути файл
@@ -29,6 +29,7 @@ export interface LanguagesValid {
python: { interpreter: string; activateVirtualenv: boolean };
ruby: { interpreter: string };
node: { interpreter: string; packageManager: "" | "npm" | "pnpm" | "yarn" | "bun" };
php: { interpreter: string };
rust: {
toolchain: string;
stdlib: string;
@@ -82,6 +83,7 @@ export const DEFAULT_LANGUAGES: LanguagesValid = {
python: { interpreter: "", activateVirtualenv: true },
ruby: { interpreter: "" },
node: { interpreter: "", packageManager: "" },
php: { interpreter: "" },
rust: { toolchain: "", stdlib: "", checkOnSave: true, checkCommand: "check", rustfmtArgs: "" },
go: { goroot: "", gopath: "", buildTags: DEFAULT_GO_BUILD_TAGS, modules: { env: {}, autoVendor: true } },
typescript: { version: "bundled" },
@@ -168,6 +170,7 @@ export function validateLanguages(raw: unknown): LanguagesValid {
const py = obj(l.python);
const ruby = obj(l.ruby);
const node = obj(l.node);
const php = obj(l.php);
const rust = obj(l.rust);
const go = obj(l.go);
const tags = obj(go.buildTags);
@@ -188,6 +191,7 @@ export function validateLanguages(raw: unknown): LanguagesValid {
interpreter: text(node.interpreter, d.node.interpreter),
packageManager: oneOf(node.packageManager, ["", "npm", "pnpm", "yarn", "bun"] as const, d.node.packageManager),
},
php: { interpreter: text(php.interpreter, d.php.interpreter) },
rust: {
toolchain: text(rust.toolchain, d.rust.toolchain),
stdlib: text(rust.stdlib, d.rust.stdlib),
+14 -2
Переглянути файл
@@ -4884,8 +4884,6 @@
"No interpreter": "无解释器",
"Add New Interpreter…": "添加新的解释器…",
"Interpreter Settings…": "解释器设置…",
"Cannot select Python interpreter": "无法选择 Python 解释器",
"Python Interpreter: {label}": "Python 解释器:{label}",
"Connection settings for SQL Server.": "SQL Server 的连接设置。",
"Microsoft SQL Server": "微软 SQL Server",
"Add to .gitignore": "添加到 .gitignore",
@@ -5580,9 +5578,23 @@
"Settings module": "设置模块",
"Passed as --settings; empty keeps DJANGO_SETTINGS_MODULE or the default in manage.py": "作为 --settings 传入;留空则沿用 DJANGO_SETTINGS_MODULE 或 manage.py 中的默认值",
"e.g. --keepdb --parallel": "例如 --keepdb --parallel",
"Run PHPUnit tests": "运行 PHPUnit 测试",
"e.g. vendor/bin/phpunit, phpunit, vendor/bin/pest": "例如 vendor/bin/phpunit、phpunit、vendor/bin/pest",
"Test file or directory; empty runs the suites of the configuration file": "测试文件或目录;留空则运行配置文件中的测试套件",
"Passed as --configuration; empty lets PHPUnit find phpunit.xml(.dist)": "作为 --configuration 传入;留空则由 PHPUnit 自行查找 phpunit.xml(.dist)",
"Test filter": "测试过滤器",
"Passed as --filter: a test name or a regular expression": "作为 --filter 传入:测试名称或正则表达式",
"PHPUnit options": "PHPUnit 选项",
"e.g. --stop-on-failure --testsuite unit": "例如 --stop-on-failure --testsuite unit",
"CLI Interpreter": "CLI 解释器",
"PHP interpreter": "PHP 解释器",
"Runs PHP scripts, PHPUnit, Composer and artisan, and the PHP-based language servers (phpactor). Its folder is put first on PATH, so vendor/bin/phpunit and other #!/usr/bin/env php scripts use it too.": "运行 PHP 脚本、PHPUnit、Composer 和 artisan,以及基于 PHP 的语言服务器(phpactor)。其所在文件夹会被置于 PATH 最前,因此 vendor/bin/phpunit 等 #!/usr/bin/env php 脚本也会使用它。",
"Select PHP Interpreter": "选择 PHP 解释器",
"select files in a git repository to shelve": "请选择 Git 仓库中的文件以搁置更改",
"select files from a single git repository to shelve": "请一次只选择同一个 Git 仓库中的文件以搁置更改",
"External file changes sync may be slow": "外部文件更改同步可能较慢",
"Cannot select Python interpreter": "无法选择 Python 解释器",
"Python Interpreter: {label}": "Python 解释器:{label}",
"recursive": "递归",
"Java project import failed": "Java 项目导入失败",
"The Java project cannot be imported because these files use a name Windows reserves for devices: {paths}. Delete or rename them, then restart the Java language server.": "无法导入 Java 项目,因为这些文件使用了 Windows 保留的设备名:{paths}。请删除或重命名这些文件,然后重启 Java 语言服务器。",
+7
Переглянути файл
@@ -145,6 +145,8 @@ const UNTRANSLATED = new Set<string>([
"MySQL",
"Neon",
"Node.js",
"PHP",
"Python",
"npm",
"OpenIDEA",
"Spring Boot",
@@ -219,6 +221,11 @@ const UNTRANSLATED = new Set<string>([
"node_modules/typescript",
"PascalCase",
"polls.tests",
"CalculatorTest::testAdd",
"phpunit.xml",
"PHPUnit",
"tests/Unit",
"vendor/bin/phpunit",
"pylyzer --server",
"pyproject.toml, .git",
"run pytest",