Conditions | 1 |
Paths | 1 |
Total Lines | 19 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
38 | public function save(UnitTester $I) |
||
39 | { |
||
40 | $creditWorklog = new CreditWorkLog(); |
||
41 | $creditWorklog->process_id = 4; // current stage_id = 7 |
||
42 | $creditWorklog->stage_id = 4; |
||
43 | $I->expectThrowable( |
||
44 | ForbiddenHttpException::class, |
||
45 | function () use ($creditWorklog) { |
||
46 | $creditWorklog->save(); |
||
47 | } |
||
48 | ); |
||
49 | |||
50 | $auth = Yii::$app->authManager; |
||
51 | $adminRole = $auth->getRole('admin'); |
||
52 | $auth->assign($adminRole, 1); |
||
53 | Yii::$app->user->login(User::findOne(1)); |
||
54 | |||
55 | $I->assertTrue($creditWorklog->save()); |
||
56 | $auth->revoke($adminRole, 1); |
||
57 | } |
||
58 | } |