Skip to content

Commit e721be4

Browse files
committed
fix tests
1 parent 5209756 commit e721be4

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

tests/commands/ApiControllerTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,14 @@ public function testGenerateBootstrap()
100100

101101
$this->assertSame($sourceFilesCount, $filesCount);
102102

103-
$this->assertMatchesTextSnapshot(file_get_contents("{$outputPath}/warnings.txt"));
104-
$this->assertMatchesTextSnapshot(file_get_contents("{$outputPath}/errors.txt"));
103+
$warningsContent = file_get_contents("{$outputPath}/warnings.txt");
104+
// Remove the dynamic parts of the paths to the files
105+
$warningsContent = preg_replace('/(\s*\[file\] => ).*(\/tests\/.*\.php)/', '$1$2', $warningsContent);
106+
$this->assertMatchesTextSnapshot($warningsContent);
107+
108+
$errorsContent = file_get_contents("{$outputPath}/errors.txt");
109+
// Remove the dynamic parts of the paths to the files
110+
$errorsContent = preg_replace('/(\s*\[file\] => ).*(\/tests\/.*\.php)/', '$1$2', $errorsContent);
111+
$this->assertMatchesTextSnapshot($errorsContent);
105112
}
106113
}

tests/commands/__snapshots__/ApiControllerTest__testGenerateBootstrap__5.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,63 +3,63 @@ Array
33
[0] => Array
44
(
55
[line] => 41
6-
[file] => /home/mspirkov/open-source/yiisoft/yii2-apidoc/tests/data/api/animal/Animal.php
6+
[file] => /tests/data/api/animal/Animal.php
77
[message] => No docblock for element '$propertyWithoutDoc'
88
)
99

1010
[1] => Array
1111
(
1212
[line] => 41
13-
[file] => /home/mspirkov/open-source/yiisoft/yii2-apidoc/tests/data/api/animal/Animal.php
13+
[file] => /tests/data/api/animal/Animal.php
1414
[message] => No short description for element '$propertyWithoutDoc'
1515
)
1616

1717
[2] => Array
1818
(
1919
[line] => 43
20-
[file] => /home/mspirkov/open-source/yiisoft/yii2-apidoc/tests/data/api/animal/Animal.php
20+
[file] => /tests/data/api/animal/Animal.php
2121
[message] => No docblock for element '$propertyWithoutDocAndTypeHint'
2222
)
2323

2424
[3] => Array
2525
(
2626
[line] => 43
27-
[file] => /home/mspirkov/open-source/yiisoft/yii2-apidoc/tests/data/api/animal/Animal.php
27+
[file] => /tests/data/api/animal/Animal.php
2828
[message] => No short description for element '$propertyWithoutDocAndTypeHint'
2929
)
3030

3131
[4] => Array
3232
(
3333
[line] => 70
34-
[file] => /home/mspirkov/open-source/yiisoft/yii2-apidoc/tests/data/api/animal/Animal.php
34+
[file] => /tests/data/api/animal/Animal.php
3535
[message] => No docblock for element 'setBirthDate'
3636
)
3737

3838
[5] => Array
3939
(
4040
[line] => 32
41-
[file] => /home/mspirkov/open-source/yiisoft/yii2-apidoc/tests/data/api/animal/Cat.php
41+
[file] => /tests/data/api/animal/Cat.php
4242
[message] => No docblock for element 'methodWithoutDocAndTypeHints'
4343
)
4444

4545
[6] => Array
4646
(
4747
[line] => 40
48-
[file] => /home/mspirkov/open-source/yiisoft/yii2-apidoc/tests/data/api/animal/Cat.php
48+
[file] => /tests/data/api/animal/Cat.php
4949
[message] => No short description for Method 'methodWithTodoTag'
5050
)
5151

5252
[7] => Array
5353
(
5454
[line] => 30
55-
[file] => /home/mspirkov/open-source/yiisoft/yii2-apidoc/tests/data/api/animal/Dog.php
55+
[file] => /tests/data/api/animal/Dog.php
5656
[message] => No short description for Method 'methodWithInvalidReturnTag'
5757
)
5858

5959
[8] => Array
6060
(
6161
[line] => 11
62-
[file] => /home/mspirkov/open-source/yiisoft/yii2-apidoc/tests/data/api/base/Component.php
62+
[file] => /tests/data/api/base/Component.php
6363
[message] => No docblock for element 'yiiunit\apidoc\data\api\base\Component'
6464
)
6565

tests/commands/__snapshots__/ApiControllerTest__testGenerateBootstrap__6.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Array
33
[0] => Array
44
(
55
[line] => 30
6-
[file] => /home/mspirkov/open-source/yiisoft/yii2-apidoc/tests/data/api/animal/Dog.php
6+
[file] => /tests/data/api/animal/Dog.php
77
[message] => Invalid tag: @return invalid-type. Exception message: "\yiiunit\apidoc\data\api\animal\invalid-type" is not a valid Fqsen.
88
)
99

0 commit comments

Comments
 (0)