Skip to content

Commit 9be9345

Browse files
committed
fix #295 ignore case
1 parent 07c5d4c commit 9be9345

3 files changed

Lines changed: 37 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"displayName": "PHPUnit Test Explorer",
55
"icon": "img/icon.png",
66
"publisher": "recca0120",
7-
"version": "3.5.34",
7+
"version": "3.5.35",
88
"private": true,
99
"license": "MIT",
1010
"repository": {

src/PHPUnit/TestParser/AnnotationParser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ const lookup = ['depends', 'dataProvider', 'testdox'];
55

66
export class AttributeParser {
77
public parse(declaration: Declaration) {
8-
const parsed = this.parseAttributes(declaration);
8+
const attributes = this.parseAttributes(declaration);
99
const annotations = {} as Annotations;
1010

1111
for (const property of lookup) {
12-
const values = parsed
12+
const values = attributes
1313
.filter((attribute: any) => new RegExp(property, 'i').test(attribute.name))
1414
.map((attribute: any) => attribute.args[0]);
1515

@@ -64,7 +64,7 @@ export class AnnotationParser {
6464

6565
private readonly pattern: RegExp = new RegExp(
6666
lookup.map((name) => this.template(name)).join('|'),
67-
'g',
67+
'ig',
6868
);
6969

7070
private parseComments(declaration: Declaration) {

src/PHPUnit/TestParser/PHPUnitParser.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,4 +456,37 @@ final class ArrayConstTest extends TestCase {
456456
depth: 2,
457457
}));
458458
});
459+
460+
it('ignore annotation string case', () => {
461+
const file = phpUnitProject('tests/TestDoxTest.php');
462+
const content = `<?php declare(strict_types=1);
463+
464+
use PHPUnit\\Framework\\TestCase;
465+
466+
final class TestDoxTest extends TestCase {
467+
/**
468+
* @testDox Do a test
469+
* @testWIth [1,1]
470+
* [2,2]
471+
* [3,3]
472+
*/
473+
public function testAtTestWith($a,$b){
474+
$this->assertEquals($a,$b);
475+
}
476+
}
477+
`;
478+
expect(givenTest(file, content, 'testAtTestWith')).toEqual(expect.objectContaining({
479+
type: TestType.method,
480+
file,
481+
id: 'Test Dox::At test with',
482+
classFQN: 'TestDoxTest',
483+
className: 'TestDoxTest',
484+
methodName: 'testAtTestWith',
485+
label: 'Do a test',
486+
annotations: { 'testdox': ['Do a test'] },
487+
start: { line: expect.any(Number), character: expect.any(Number) },
488+
end: { line: expect.any(Number), character: expect.any(Number) },
489+
depth: 2,
490+
}));
491+
});
459492
});

0 commit comments

Comments
 (0)