Skip to content

Commit

Permalink
fix: space problem
Browse files Browse the repository at this point in the history
  • Loading branch information
elonmallin committed Mar 5, 2024
1 parent c73e6d9 commit 3118167
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "phpunit",
"displayName": "PHPUnit",
"description": "Run PHPUnit tests from VSCode.",
"version": "4.12.0",
"version": "4.16.0",
"publisher": "emallin",
"icon": "images/phpunit.png",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion src/PhpunitCommand/PhpunitArgBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class PhpunitArgBuilder {
...(this.filter ? ["--filter", `'${this.filter}'`] : []),
...(this.groups.length > 0 ? ["--group", this.groups.join(",")] : []),
...this.args,
...this.directoryOrFiles,
...this.directoryOrFiles.map((directoryOrFile) => `'${directoryOrFile}'`),
].filter((part) => part);

if (this.pathMappings) {
Expand Down
9 changes: 9 additions & 0 deletions src/test/php-project/tests/Space Test/SimpleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

use PHPUnit\Framework\TestCase;

class SimpleTest extends TestCase {
public function testSimple() {
$this->assertTrue(true);
}
}
29 changes: 29 additions & 0 deletions src/test/suite/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,35 @@ suite("php-project e2e", () => {
assert.equal(task.exitCode, 0);
});

test("phpunit.Test Class space in path", async () => {
const uri = vscode.Uri.file(
path.resolve(
vscode.workspace.workspaceFolders![0].uri.fsPath,
"tests/Space Test/SimpleTest.php",
),
);
const document = await vscode.workspace.openTextDocument(uri);
await vscode.window.showTextDocument(document, {
selection: new vscode.Range(4, 0, 4, 0),
});

await vscode.workspace
.getConfiguration("phpunit")
.update("preferRunClassTestOverQuickPickWindow", true);

const taskOutputPromise = getOnDidEndTaskProcessPromise(
myExtensionApi.testRedirectedOutputFile,
);
const res = await vscode.commands.executeCommand("phpunit.Test");
const task = await taskOutputPromise;

assert.match(
task.output,
/PHPUnit .* by Sebastian Bergmann and contributors./,
);
assert.equal(task.exitCode, 0);
});

test("phpunit.Test Function", async () => {
const uri = vscode.Uri.file(
path.resolve(
Expand Down

0 comments on commit 3118167

Please sign in to comment.