From 5bfcc7e70780438b339731273e7793a74b24e59b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 29 Jan 2015 20:57:21 +0100 Subject: [PATCH] [ticket/13522] Add test file for Q&A captcha PHPBB3-13522 --- tests/captcha/qa_test.php | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/captcha/qa_test.php diff --git a/tests/captcha/qa_test.php b/tests/captcha/qa_test.php new file mode 100644 index 0000000000..51bc09d309 --- /dev/null +++ b/tests/captcha/qa_test.php @@ -0,0 +1,46 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_qa_test extends \phpbb_database_test_case +{ + protected $request; + + /** @var \phpbb\captcha\plugins\qa */ + protected $qa; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/../fixtures/empty.xml'); + } + + public function setUp() + { + global $db; + + $db = $this->new_dbal(); + + parent::setUp(); + + $this->request = new \phpbb_mock_request(); + $this->qa = new \phpbb\captcha\plugins\qa($this->request, 'phpbb_captcha_questions', 'phpbb_captcha_answers', 'phpbb_qa_confirm'); + } + + public function test_is_installed() + { + $this->assertFalse($this->qa->is_installed()); + + $this->qa->install(); + + $this->assertTrue($this->qa->is_installed()); + } +} \ No newline at end of file