From dd3154b1036d40431a2d6dad94d72e2c6fdc7b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 1 Nov 2017 14:30:14 +0100 Subject: [PATCH] Test check method for simple second factor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- test/classes/SecondFactorTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/classes/SecondFactorTest.php b/test/classes/SecondFactorTest.php index ce5e7183cc..2b5ac768f8 100644 --- a/test/classes/SecondFactorTest.php +++ b/test/classes/SecondFactorTest.php @@ -64,6 +64,13 @@ class SecondFactorTest extends PmaTestCase $backend = $object->backend; $this->assertEquals('simple', $backend::$id); $GLOBALS['cfg']['DBG']['simple2fa'] = false; + + unset($_POST['2fa_confirm']); + $this->assertFalse($object->check()); + + $_POST['2fa_confirm'] = 1; + $this->assertTrue($object->check()); + unset($_POST['2fa_confirm']); } public function testLoad() @@ -95,6 +102,7 @@ class SecondFactorTest extends PmaTestCase $this->markTestSkipped('google2fa not available'); } /* Without providing code this should fail */ + unset($_POST['2fa_code']); $this->assertFalse($object->configure('application')); /* Invalid code */ @@ -108,6 +116,7 @@ class SecondFactorTest extends PmaTestCase $google2fa->getTimestamp() ); $this->assertTrue($object->configure('application')); + unset($_POST['2fa_code']); } public function testKey() @@ -117,6 +126,7 @@ class SecondFactorTest extends PmaTestCase $this->markTestSkipped('u2f-php-server not available'); } /* Without providing code this should fail */ + unset($_POST['u2f_registration_response']); $this->assertFalse($object->configure('key')); /* Invalid code */