Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
18 / 18 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| phpbb_session_create_test | |
100.00% |
18 / 18 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| getDataSet | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| bot | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| test_bot_session | |
100.00% |
12 / 12 |
|
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_create_test extends phpbb_session_test_case |
| 17 | { |
| 18 | public function getDataSet() |
| 19 | { |
| 20 | return $this->createXMLDataSet(__DIR__ . '/fixtures/sessions_full.xml'); |
| 21 | } |
| 22 | |
| 23 | static function bot($bot_agent, $user_id, $bot_ip) |
| 24 | { |
| 25 | return array(array( |
| 26 | 'bot_agent' => $bot_agent, |
| 27 | 'user_id' => $user_id, |
| 28 | 'bot_ip' => $bot_ip, |
| 29 | )); |
| 30 | } |
| 31 | |
| 32 | function test_bot_session() |
| 33 | { |
| 34 | $output = $this->session_facade->session_create( |
| 35 | false, |
| 36 | false, |
| 37 | false, |
| 38 | false, |
| 39 | array(), |
| 40 | 'user agent', |
| 41 | '127.0.0.1', |
| 42 | self::bot('user agent', 13, '127.0.0.1'), |
| 43 | '' |
| 44 | ); |
| 45 | $this->assertEquals(true, $output->data['is_bot'], 'should be a bot'); |
| 46 | } |
| 47 | } |