Skip to content

Commit 608586e

Browse files
committed
Fix failing tests
1 parent ec2c4ea commit 608586e

File tree

17 files changed

+304
-3
lines changed

17 files changed

+304
-3
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace app\abc;
4+
5+
class Module extends \yii\base\Module
6+
{
7+
8+
public function init()
9+
{
10+
parent::init();
11+
}
12+
13+
14+
}
15+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace app\abc;
4+
5+
class TaskController extends \app\abc\base\TaskController
6+
{
7+
8+
public function checkAccess($action, $model = null, $params = [])
9+
{
10+
//TODO implement checkAccess
11+
}
12+
13+
14+
}
15+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace app\abc\base;
4+
5+
abstract class TaskController extends \yii\rest\Controller
6+
{
7+
public function actions()
8+
{
9+
return [
10+
'view' => [
11+
'class' => \yii\rest\ViewAction::class,
12+
'modelClass' => \app\models\Task::class,
13+
'checkAccess' => [$this, 'checkAccess'],
14+
],
15+
'options' => [
16+
'class' => \yii\rest\OptionsAction::class,
17+
],
18+
];
19+
}
20+
21+
/**
22+
* Checks the privilege of the current user.
23+
*
24+
* This method checks whether the current user has the privilege
25+
* to run the specified action against the specified data model.
26+
* If the user does not have access, a [[ForbiddenHttpException]] should be thrown.
27+
*
28+
* @param string $action the ID of the action to be executed
29+
* @param object $model the model to be accessed. If null, it means no specific model is being accessed.
30+
* @param array $params additional parameters
31+
* @throws \yii\web\ForbiddenHttpException if the user does not have access
32+
*/
33+
abstract public function checkAccess($action, $model = null, $params = []);
34+
35+
}

tests/specs/issue_fix/14_module_config_in_url_prefixes/mysql/config/urls.rest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
* This file is auto generated.
66
*/
77
return [
8-
'GET hi/' => 'greet/default/',
9-
'hi/' => 'greet/default/options',
8+
'GET hi' => 'greet/default',
9+
'GET bye' => 'bye/list',
10+
'POST bye' => 'bye/create',
11+
'GET abc/task/<id:\d+>' => 'abc/task/view',
12+
'hi' => 'greet/options',
13+
'bye' => 'bye/options',
14+
'abc/task/<id:\d+>' => 'abc/task/options',
1015
];
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace app\controllers;
4+
5+
class ByeController extends \app\controllers\base\ByeController
6+
{
7+
8+
public function checkAccess($action, $model = null, $params = [])
9+
{
10+
//TODO implement checkAccess
11+
}
12+
13+
public function actionList()
14+
{
15+
//TODO implement actionList
16+
}
17+
18+
public function actionCreate()
19+
{
20+
//TODO implement actionCreate
21+
}
22+
23+
24+
}
25+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace app\controllers\base;
4+
5+
abstract class ByeController 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 actionList();
31+
32+
abstract public function actionCreate();
33+
34+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace app\models;
4+
5+
class Task extends \app\models\base\Task
6+
{
7+
8+
9+
}
10+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/**
4+
* This file is generated by Gii, do not change manually!
5+
*/
6+
7+
namespace app\models\base;
8+
9+
/**
10+
* This is the model class for table "tasks".
11+
*
12+
* @property int $id
13+
* @property string $title
14+
*
15+
*/
16+
abstract class Task extends \yii\db\ActiveRecord
17+
{
18+
public static function tableName()
19+
{
20+
return '{{%tasks}}';
21+
}
22+
23+
public function rules()
24+
{
25+
return [
26+
'trim' => [['title'], 'trim'],
27+
'title_string' => [['title'], 'string'],
28+
];
29+
}
30+
}

tests/specs/issue_fix/14_nested_module_in_x_route/mysql/config/urls.rest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
*/
77
return [
88
'GET ' => 'fruit/mango/alphonso/view',
9-
'' => 'fruit/alphonso/options',
9+
'GET task/<id:\d+>' => 'fruit2/mango/alphonso/view',
10+
'' => 'fruit/mango/alphonso/options',
11+
'task/<id:\d+>' => 'fruit2/mango/alphonso/options',
1012
];
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace app\models;
4+
5+
class Task extends \app\models\base\Task
6+
{
7+
8+
9+
}
10+

0 commit comments

Comments
 (0)