Skip to content

Commit 697af0e

Browse files
committed
Fix error in test
1 parent 0b106c5 commit 697af0e

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

TODO.taskpaper

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
TODO.taskpaper
2+
3+
☐ fix failing tests
4+
☐ resolve all TODOs
5+
☐ resolve all sub tasks of issue - Support for Yii Modules in x-route and pertinent places #14
6+
☐ delete this file

src/lib/generators/RestActionGenerator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ protected function prepareAction(
155155
'responseWrapper' => $responseWrapper,
156156
'prefix' => $routeData->getPrefix(),
157157
'prefixSettings' => $routeData->getPrefixSettings(),
158-
'xRoute' => $customRoute # TODO
159158
],
160159
]);
161160
}

tests/specs/issue_fix/35_resolve_todo_re_check_options_route_in_fractal_action/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
],
1010
'generateControllers' => true,
1111
'generateMigrations' => false,
12-
'useJsonApi' => false,
12+
'useJsonApi' => true,
1313
'urlPrefixes' => [
1414
'animals' => '',
1515
'/info' => ['module' => 'petinfo', 'namespace' => '\app\modules\petinfo\controllers'],

tests/unit/IssueFixTest.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -917,10 +917,18 @@ public function test35ResolveTodoReCheckOptionsRouteInFractalAction()
917917
// https://github.com/php-openapi/yii2-openapi/issues/35
918918
public function test35ResolveTodoReCheckOptionsRouteInRestAction()
919919
{
920-
$testFile = Yii::getAlias("@specs/issue_fix/35_resolve_todo_re_check_options_route_in_fractal_action/index.php");
921-
$content = str_replace("'useJsonApi' => true,", "'useJsonApi' => false,", file_get_contents($testFile));
922-
file_put_contents($testFile, $content);
923-
$this->runGenerator($testFile);
920+
$config = require_once Yii::getAlias("@specs/issue_fix/35_resolve_todo_re_check_options_route_in_fractal_action/index.php");
921+
// $content = str_replace("'useJsonApi' => true,", "'useJsonApi' => false,", file_get_contents($testFile));
922+
// file_put_contents($testFile, $content); # TODO this is erroneous
923+
924+
$config['useJsonApi'] = false;
925+
926+
$tmpConfigFile = Yii::getAlias("@runtime") . "/tmp-config-35.php";
927+
file_put_contents($tmpConfigFile, '<?php return ' . var_export($config, true) . ';');
928+
929+
930+
931+
$this->runGenerator($tmpConfigFile);
924932
$actualFiles = FileHelper::findFiles(Yii::getAlias('@app'), [
925933
'recursive' => true,
926934
]);

0 commit comments

Comments
 (0)