Skip to content

Commit ecbee94

Browse files
committed
Complete the test
1 parent 49cd50e commit ecbee94

File tree

3 files changed

+68
-7
lines changed

3 files changed

+68
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace app\controllers;
4+
5+
class MangoController extends \app\controllers\base\MangoController
6+
{
7+
8+
public function checkAccess($action, $model = null, $params = [])
9+
{
10+
//TODO implement checkAccess
11+
}
12+
13+
public function actionCake()
14+
{
15+
// TODO implement actionCake
16+
// In order to conform with OpenAPI spec, response of this action must have one of the following HTTP status code: 200, 403, 404
17+
}
18+
19+
public function actionCreateCake()
20+
{
21+
// TODO implement actionCreateCake
22+
// In order to conform with OpenAPI spec, response of this action must have one of the following HTTP status code: 201, 403, 404, 422
23+
}
24+
25+
26+
}
27+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace app\controllers\base;
4+
5+
abstract class MangoController 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 actionCake();
31+
32+
abstract public function actionCreateCake();
33+
34+
}

tests/unit/IssueFixTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,12 +1020,12 @@ public function test79ResponseStatusCodesAreNotTheCodesDefinedInSpec()
10201020
{
10211021
$testFile = Yii::getAlias("@specs/issue_fix/79_response_status_codes_are_not_the_codes_defined_in_spec/index.php");
10221022
$this->runGenerator($testFile);
1023-
// $actualFiles = FileHelper::findFiles(Yii::getAlias('@app'), [
1024-
// 'recursive' => true,
1025-
// ]);
1026-
// $expectedFiles = FileHelper::findFiles(Yii::getAlias("@specs/issue_fix/79_response_status_codes_are_not_the_codes_defined_in_spec/mysql"), [
1027-
// 'recursive' => true,
1028-
// ]);
1029-
// $this->checkFiles($actualFiles, $expectedFiles);
1023+
$actualFiles = FileHelper::findFiles(Yii::getAlias('@app'), [
1024+
'recursive' => true,
1025+
]);
1026+
$expectedFiles = FileHelper::findFiles(Yii::getAlias("@specs/issue_fix/79_response_status_codes_are_not_the_codes_defined_in_spec/mysql"), [
1027+
'recursive' => true,
1028+
]);
1029+
$this->checkFiles($actualFiles, $expectedFiles);
10301030
}
10311031
}

0 commit comments

Comments
 (0)