Browse Source

Update CookieCryptTrait.php

Specify in the error message, that false is an option.
Daniel Platt 7 years ago
parent
commit
9d749c81d5

+ 1 - 1
src/Utility/CookieCryptTrait.php

@@ -84,7 +84,7 @@ trait CookieCryptTrait
     {
         if (!in_array($encrypt, $this->_validCiphers)) {
             $msg = sprintf(
-                'Invalid encryption cipher. Must be one of %s.',
+                'Invalid encryption cipher. Must be one of %s or false.',
                 implode(', ', $this->_validCiphers)
             );
             throw new RuntimeException($msg);

+ 2 - 2
tests/TestCase/Controller/Component/CookieComponentTest.php

@@ -166,7 +166,7 @@ class CookieComponentTest extends TestCase
     public function testReadInvalidCipher()
     {
         $this->expectException(\RuntimeException::class);
-        $this->expectExceptionMessage('Invalid encryption cipher. Must be one of aes, rijndael.');
+        $this->expectExceptionMessage('Invalid encryption cipher. Must be one of aes, rijndael or false.');
         $this->Controller->request = $this->request->withCookieParams([
             'Test' => $this->_encrypt('value'),
         ]);
@@ -249,7 +249,7 @@ class CookieComponentTest extends TestCase
     public function testWriteInvalidCipher()
     {
         $this->expectException(\RuntimeException::class);
-        $this->expectExceptionMessage('Invalid encryption cipher. Must be one of aes, rijndael.');
+        $this->expectExceptionMessage('Invalid encryption cipher. Must be one of aes, rijndael or false.');
         $this->Cookie->setConfig('encryption', 'derp');
         $this->Cookie->write('Test', 'nope');
     }