File tree Expand file tree Collapse file tree 7 files changed +108
-16
lines changed
specs/issue_fix/14_nested_module_in_x_route/mysql Expand file tree Collapse file tree 7 files changed +108
-16
lines changed Original file line number Diff line number Diff line change 9
9
10
10
trait ActionHelperTrait
11
11
{
12
- /**
13
- * @var ?string
14
- */
15
- public $ xRoute ;
12
+ public ?string $ xRoute ;
16
13
17
- /**
18
- * @var array list of module this action is part of. 'key' is module ID and 'value' is path where Module.php file must be generated
19
- */
20
- public $ modulesList = [];
14
+ # list of module this action is part of. 'key' is module ID and 'value' is path where Module.php file must be generated
15
+ public array $ modulesList = [];
21
16
22
17
public function getOptionsRoute ():string
23
18
{
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * OpenAPI UrlRules
4
+ *
5
+ * This file is auto generated.
6
+ */
7
+ return [
8
+ 'GET ' => 'fruit/mango/alphonso/view ' ,
9
+ '' => 'fruit/alphonso/options ' ,
10
+ ];
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace app \fruit ;
4
+
5
+ class Module extends \yii \base \Module
6
+ {
7
+
8
+ public function init ()
9
+ {
10
+ parent ::init ();
11
+ $ this ->modules = [
12
+ 'mango ' => [
13
+ // you should consider using a shorter namespace here!
14
+ 'class ' => \app \fruit \mango \Module::class,
15
+ ],
16
+ ];
17
+ }
18
+
19
+
20
+ }
21
+
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace app \fruit \mango ;
4
+
5
+ class Module extends \yii \base \Module
6
+ {
7
+
8
+ public function init ()
9
+ {
10
+ parent ::init ();
11
+ }
12
+
13
+
14
+ }
15
+
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace app \fruit \mango \controllers ;
4
+
5
+ class AlphonsoController extends \app \fruit \mango \controllers \base \AlphonsoController
6
+ {
7
+
8
+ public function checkAccess ($ action , $ model = null , $ params = [])
9
+ {
10
+ //TODO implement checkAccess
11
+ }
12
+
13
+ public function actionView ()
14
+ {
15
+ //TODO implement actionView
16
+ }
17
+
18
+
19
+ }
20
+
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace app \fruit \mango \controllers \base ;
4
+
5
+ abstract class AlphonsoController extends \yii \rest \Controller
6
+ {
7
+ public function actions ()
8
+ {
9
+ return [
10
+ 'options ' => [
11
+ 'class ' => \yii \rest \OptionsAction::class,
12
+ ],
13
+ ];
14
+ }
15
+
16
+ /**
17
+ * Checks the privilege of the current user.
18
+ *
19
+ * This method checks whether the current user has the privilege
20
+ * to run the specified action against the specified data model.
21
+ * If the user does not have access, a [[ForbiddenHttpException]] should be thrown.
22
+ *
23
+ * @param string $action the ID of the action to be executed
24
+ * @param object $model the model to be accessed. If null, it means no specific model is being accessed.
25
+ * @param array $params additional parameters
26
+ * @throws \yii\web\ForbiddenHttpException if the user does not have access
27
+ */
28
+ abstract public function checkAccess ($ action , $ model = null , $ params = []);
29
+
30
+ abstract public function actionView ();
31
+
32
+ }
Original file line number Diff line number Diff line change 4
4
5
5
use tests \DbTestCase ;
6
6
use Yii ;
7
- use yii \base \InvalidArgumentException ;
8
7
use yii \helpers \FileHelper ;
9
8
10
9
# https://github.com/php-openapi/yii2-openapi/issues/14
@@ -14,12 +13,12 @@ public function testNestedModuleInXRoute()
14
13
{
15
14
$ testFile = Yii::getAlias ("@specs/issue_fix/14_nested_module_in_x_route/index.php " );
16
15
$ this ->runGenerator ($ testFile );
17
- // $actualFiles = FileHelper::findFiles(Yii::getAlias('@app'), [
18
- // 'recursive' => true,
19
- // ]);
20
- // $expectedFiles = FileHelper::findFiles(Yii::getAlias("@specs/issue_fix/14_nested_module_in_x_route/mysql"), [
21
- // 'recursive' => true,
22
- // ]);
23
- // $this->checkFiles($actualFiles, $expectedFiles);
16
+ $ actualFiles = FileHelper::findFiles (Yii::getAlias ('@app ' ), [
17
+ 'recursive ' => true ,
18
+ ]);
19
+ $ expectedFiles = FileHelper::findFiles (Yii::getAlias ("@specs/issue_fix/14_nested_module_in_x_route/mysql " ), [
20
+ 'recursive ' => true ,
21
+ ]);
22
+ $ this ->checkFiles ($ actualFiles , $ expectedFiles );
24
23
}
25
24
}
You can’t perform that action at this time.
0 commit comments