From 1e4988b9641dd4f8b27bc1bc239140a3994c65fd Mon Sep 17 00:00:00 2001
From: Paragon Initiative Enterprises <security@paragonie.com>
Date: Fri, 10 Jun 2022 03:04:34 -0400
Subject: [PATCH] Add test for strictness.

Resolves #22.
---
 psalm.xml            |  1 +
 tests/Base64Test.php | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/psalm.xml b/psalm.xml
index af5ec45..287c81d 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -6,6 +6,7 @@
         <directory name="src" />
         <ignoreFiles>
             <directory name="tests" />
+            <directory name="vendor" />
         </ignoreFiles>
     </projectFiles>
     <issueHandlers>
diff --git a/tests/Base64Test.php b/tests/Base64Test.php
index 339f5d2..c964686 100644
--- a/tests/Base64Test.php
+++ b/tests/Base64Test.php
@@ -84,6 +84,16 @@ class Base64Test extends TestCase
         }
     }
 
+    public function testIssue22()
+    {
+        // Non-strict: ok
+        Base64::decode('00==');
+
+        // Strict: not ok
+        $this->expectException(RangeException::class);
+        Base64::decode('00==', true);
+    }
+
     /**
      * @dataProvider canonicalDataProvider
      */
-- 
GitLab