From c4c23c31a5f408f9ffcf93e43a4b7ba97f33a2e2 Mon Sep 17 00:00:00 2001
From: Thijs Kinkhorst <thijs@kinkhorst.com>
Date: Wed, 21 Nov 2018 22:58:47 +0000
Subject: [PATCH] For completeness also add a Bad test for pw without algo

---
 tests/lib/SimpleSAML/Utils/CryptoTest.php | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/lib/SimpleSAML/Utils/CryptoTest.php b/tests/lib/SimpleSAML/Utils/CryptoTest.php
index 16c145ad3..044fb054a 100644
--- a/tests/lib/SimpleSAML/Utils/CryptoTest.php
+++ b/tests/lib/SimpleSAML/Utils/CryptoTest.php
@@ -224,6 +224,20 @@ PHP;
         $this->assertTrue($res);
     }
 
+    /**
+     * @covers \SimpleSAML\Utils\Crypto::pwValid
+     */
+    public function testBadPwInvalid()
+    {
+        $pw = "password";
+        $pw2 = "password2";
+
+        $hash = Crypto::pwHash($pw);
+        $res = Crypto::pwValid($hash, $pw2);
+
+        $this->assertFalse($res);
+    }
+
 
     /**
      * @covers \SimpleSAML\Utils\Crypto::pwValid
-- 
GitLab