]> git.mxchange.org Git - friendica.git/blobdiff - tests/Util/StaticCookie.php
Add response for JSON only
[friendica.git] / tests / Util / StaticCookie.php
index 01a8c49be46d825072232fc70ad3836461a2f6d9..a66025bf543958a7518ca8eafbfd76f8cc3b6917 100644 (file)
@@ -1,4 +1,23 @@
 <?php
+/**
+ * @copyright Copyright (C) 2010-2021, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Test\Util;
 
@@ -14,10 +33,26 @@ class StaticCookie extends Cookie
        /** @var int The last expire time set */
        public static $_EXPIRE;
 
-       protected function setCookie(string $name, string $value = null, int $expire = null, bool $secure = null)
+       /**
+        * Send a cookie - protected, internal function for test-mocking possibility
+        *
+        * @param string $value  [optional]
+        * @param int    $expire [optional]
+        * @param bool   $secure [optional]
+        * @return bool
+        *
+        * @noinspection PhpMissingParentCallCommonInspection
+        *
+        * @link         https://php.net/manual/en/function.setcookie.php
+        *
+        * @see          Cookie::setCookie()
+        */
+       protected function setCookie(string $value = null, int $expire = null, bool $secure = null): bool
        {
-               self::$_COOKIE[$name] = $value;
+               self::$_COOKIE[self::NAME] = $value;
                self::$_EXPIRE = $expire;
+
+               return true;
        }
 
        public static function clearStatic()