Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
20 / 20 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| phpbb_session_unset_admin_test | |
100.00% |
20 / 20 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| getDataSet | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| get_test_session | |
100.00% |
14 / 14 |
|
100.00% |
1 / 1 |
1 | |||
| test_unset_admin | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | require_once __DIR__ . '/../test_framework/phpbb_session_test_case.php'; |
| 15 | |
| 16 | class phpbb_session_unset_admin_test extends phpbb_session_test_case |
| 17 | { |
| 18 | public function getDataSet() |
| 19 | { |
| 20 | return $this->createXMLDataSet(__DIR__ . '/fixtures/sessions_full.xml'); |
| 21 | } |
| 22 | |
| 23 | function get_test_session() |
| 24 | { |
| 25 | return $this->session_facade->session_begin( |
| 26 | true, |
| 27 | // Config |
| 28 | array( |
| 29 | 'session_length' => time(), // need to do this to allow sessions started at time 0 |
| 30 | ), |
| 31 | // Server |
| 32 | array( |
| 33 | 'HTTP_USER_AGENT' => "user agent", |
| 34 | 'REMOTE_ADDR' => "127.0.0.1", |
| 35 | ), |
| 36 | // Cookies |
| 37 | array( |
| 38 | '_sid' => 'bar_session000000000000000000000', |
| 39 | '_u' => 4, |
| 40 | ) |
| 41 | ); |
| 42 | } |
| 43 | |
| 44 | public function test_unset_admin() |
| 45 | { |
| 46 | $session = $this->get_test_session(); |
| 47 | $this->assertEquals(1, $session->data['session_admin'], 'should be an admin before test starts'); |
| 48 | $session->unset_admin(); |
| 49 | $session = $this->get_test_session(); |
| 50 | $this->assertEquals(0, $session->data['session_admin'], 'should be not be an admin after unset_admin'); |
| 51 | } |
| 52 | } |