PageRenderTime 22ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/session/create_test.php

http://github.com/phpbb/phpbb
PHP | 47 lines | 32 code | 4 blank | 11 comment | 0 complexity | 403efde85b0a553deb77a1d8a94fa0c7 MD5 | raw file
Possible License(s): GPL-3.0, AGPL-1.0
  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. require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php';
  14. class phpbb_session_create_test extends phpbb_session_test_case
  15. {
  16. public function getDataSet()
  17. {
  18. return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/sessions_full.xml');
  19. }
  20. static function bot($bot_agent, $user_id, $bot_ip)
  21. {
  22. return array(array(
  23. 'bot_agent' => $bot_agent,
  24. 'user_id' => $user_id,
  25. 'bot_ip' => $bot_ip,
  26. ));
  27. }
  28. function test_bot_session()
  29. {
  30. $output = $this->session_facade->session_create(
  31. false,
  32. false,
  33. false,
  34. false,
  35. array(),
  36. 'user agent',
  37. '127.0.0.1',
  38. self::bot('user agent', 13, '127.0.0.1'),
  39. ''
  40. );
  41. $this->assertEquals(true, $output->data['is_bot'], 'should be a bot');
  42. }
  43. }