Conditions | 1 |
Paths | 1 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public function testBeforeAction() { |
||
28 | $controller = new Controller('test', 'common'); |
||
29 | $controller->enableCsrfValidation = true; |
||
30 | |||
31 | expect("If CSRF token is valid and parent's beforeAction() returns true, return true", $this->assertTrue($controller->beforeAction('test'))); |
||
32 | |||
33 | // this is a terrible way to test this |
||
34 | // look in common/config/test.php, we are setting the request class to be |
||
35 | // \common\tests\_support\MockRequest |
||
36 | Yii::$app->getRequest()->csrfValidationReturn = false; |
||
37 | expect("If CSRF token is NOT valid and parent's beforeAction() returns true, return false", $this->assertFalse($controller->beforeAction('test'))); |
||
38 | |||
41 |