Total Complexity | 4 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
21 | class AdminsControllerTest extends IntegrationTestCase |
||
22 | { |
||
23 | /** |
||
24 | * Fixtures |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | public $fixtures = [ |
||
29 | 'app.Category', |
||
30 | 'app.Entry', |
||
31 | 'app.Setting', |
||
32 | 'app.User', |
||
33 | 'app.UserBlock', |
||
34 | 'app.UserIgnore', |
||
35 | 'app.UserOnline', |
||
36 | 'app.UserRead', |
||
37 | ]; |
||
38 | |||
39 | /** |
||
40 | * testAdminEmptyCaches method |
||
41 | * |
||
42 | * @return void |
||
43 | */ |
||
44 | public function testAdminEmptyCachesNonAdmin() |
||
45 | { |
||
46 | $url = '/admin/admins/emptyCaches'; |
||
47 | $this->get($url); |
||
48 | $this->assertRedirectLogin($url); |
||
49 | } |
||
50 | |||
51 | public function testAdminEmptyCachesUser() |
||
52 | { |
||
53 | $this->_loginUser(2); |
||
54 | $url = '/admin/admins/emptyCaches'; |
||
55 | $this->expectException(SaitoForbiddenException::class); |
||
56 | $this->get($url); |
||
57 | } |
||
58 | |||
59 | public function testAdminEmptyCaches() |
||
60 | { |
||
61 | $this->_loginUser(1); |
||
62 | Cache::write('foo', 'bar'); |
||
63 | $this->assertEquals('bar', Cache::read('foo')); |
||
64 | $this->get('admin/admins/emptyCaches'); |
||
65 | $this->assertEmpty(Cache::read('foo')); |
||
66 | } |
||
67 | |||
68 | public function testPhpInfoUserAllowence() |
||
71 | } |
||
72 | } |
||
73 |