Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"displayName": "PHPUnit Test Explorer",
"icon": "img/icon.png",
"publisher": "recca0120",
"version": "3.7.8",
"version": "3.7.9",
"private": true,
"license": "MIT",
"repository": {
Expand Down
12 changes: 6 additions & 6 deletions src/PHPUnit/CommandBuilder/Builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('Builder Test', () => {
expect(runtime).toEqual('php');
expect(args).toEqual([
'vendor/bin/pest',
`--filter="^.*::(it has user's email)(( with (data set )?.*)?)?$"`,
`--filter=^.*::(it has user's email)(( with (data set )?.*)?)?$`,
phpUnitProject('tests/AssertionsTest.php'),
'--colors=never',
'--teamcity',
Expand Down Expand Up @@ -184,7 +184,7 @@ describe('Builder Test', () => {
[
'php',
'vendor/bin/paratest',
`--filter=^.*::(test_passed)( with data set .*)?$`,
`'--filter=^.*::(test_passed)( with data set .*)?$'`,
`--colors=never`,
`--teamcity`,
`--functional`,
Expand Down Expand Up @@ -263,7 +263,7 @@ describe('Builder Test', () => {
'php',
'artisan',
'test',
`--filter=^.*::(test_passed)( with data set .*)?$`,
`'--filter=^.*::(test_passed)( with data set .*)?$'`,
`--colors=never`,
`--teamcity`,
].join(' '),
Expand Down Expand Up @@ -292,7 +292,7 @@ describe('Builder Test', () => {
'php',
'artisan',
'test',
`--filter=^.*::(test_passed)( with data set .*)?$`,
`'--filter=^.*::(test_passed)( with data set .*)?$'`,
'--colors=never',
'--teamcity',
].join(' '),
Expand Down Expand Up @@ -394,7 +394,7 @@ describe('Builder Test', () => {
'php',
'artisan',
'test',
`--filter=^.*::(test_passed)( with data set .*)?$`,
`'--filter=^.*::(test_passed)( with data set .*)?$'`,
`--colors=never`,
`--teamcity`,
].join(' '),
Expand All @@ -418,7 +418,7 @@ describe('Builder Test', () => {
[
'php',
'vendor/bin/phpunit',
`--filter=^.*::(test_passed)( with data set .*)?$`,
`'--filter=^.*::(test_passed)( with data set .*)?$'`,
'--colors=never',
'--teamcity',
].join(' '),
Expand Down
12 changes: 8 additions & 4 deletions src/PHPUnit/CommandBuilder/Builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,22 +162,26 @@ export class Builder {
const pattern = new RegExp('^(--filter)=(.*)');

return input.replace(pattern, (_m, ...matched) => {
const value = btoa(matched[1]);
const value = Buffer.from(matched[1], 'utf-8').toString('base64');

return `${matched[0]}='${value}'`;
});
});
}

private decodeFilter(args: string[]) {
const command = args.join(' ');
const needsQuote = isSSH(command) || isShellCommand(command);

return args.map((input) => {
const pattern = new RegExp('(--filter)=["\'](.+)?["\']');

return input.replace(pattern, (_m, ...matched) => {
const value = atob(matched[1]);
const quote = value.includes('\'') ? '"' : '';
const value = Buffer.from(matched[1], 'base64').toString('utf-8');
const quote = value.includes('\'') ? '"' : '\'';
const filter = `${matched[0]}=${value}`;

return `${matched[0]}=${quote}${value}${quote}`;
return needsQuote ? `${quote}${filter}${quote}` : filter;
});
});
}
Expand Down
20 changes: 3 additions & 17 deletions src/PHPUnit/TestRunner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,20 +346,6 @@ describe('TestRunner Test', () => {

await shouldRunTestFailed(expected, builder, projectPath, appPath);
});

it('should run test failed with phpvfscomposer for Docker', async () => {
const expected = [
'php',
appPath('vendor/bin/phpunit'),
`--configuration=${appPath('phpunit.xml')}`,
`--filter=^.*::(test_passed|test_failed)( with data set .*)?$`,
appPath('tests/AssertionsTest.php'),
'--colors=never',
'--teamcity',
];

await shouldRunTestFailed(expected, builder, projectPath, appPath, true);
});
});

describe('SSH', () => {
Expand Down Expand Up @@ -441,7 +427,7 @@ describe('TestRunner Test', () => {
'php',
'vendor/bin/phpunit',
`--configuration=${appPath('phpunit.xml')}`,
`--filter=^.*::(test_passed)( with data set .*)?$`,
`'--filter=^.*::(test_passed)( with data set .*)?$'`,
appPath('tests/AssertionsTest.php'),
`--colors=never`,
`--teamcity`,
Expand All @@ -467,7 +453,7 @@ describe('TestRunner Test', () => {
'php',
'vendor/bin/phpunit',
`--configuration=${appPath('phpunit.xml')}`,
`--filter=^.*::(test_passed|test_failed)( with data set .*)?$`,
`'--filter=^.*::(test_passed|test_failed)( with data set .*)?$'`,
appPath('tests/AssertionsTest.php'),
`--colors=never`,
`--teamcity`,
Expand All @@ -493,7 +479,7 @@ describe('TestRunner Test', () => {
'php',
'vendor/bin/phpunit',
`--configuration=${appPath('phpunit.xml')}`,
`--filter=^.*::(test_passed|test_failed)( with data set .*)?$`,
`'--filter=^.*::(test_passed|test_failed)( with data set .*)?$'`,
appPath('tests/AssertionsTest.php'),
`--colors=never`,
`--teamcity`,
Expand Down
Loading