From 60855f18a8aca0ece895fbf7c2a9a0b1aadeb11a Mon Sep 17 00:00:00 2001 From: Dani Esteban Date: Mon, 9 May 2022 13:26:21 +0200 Subject: [PATCH] AD-231 Configure example instance to get a valid domain --- src/Sifo/Cookie.php | 7 +------ test/Sifo/CookieTest.php | 4 ++-- test/Sifo/TestCookie.php | 5 ----- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Sifo/Cookie.php b/src/Sifo/Cookie.php index b8b4609a..82f30253 100644 --- a/src/Sifo/Cookie.php +++ b/src/Sifo/Cookie.php @@ -49,7 +49,7 @@ static private function _initDomain() { self::$cookies = array( ); // Take domain from configuration to allow multiple subdomain compatibility with cookies. - self::$domain = static::domain(); + self::$domain = Domains::getInstance()->getDomain(); self::$path = '/'; } @@ -152,9 +152,4 @@ static protected function setCookie(string $name, $value = "", $expires = 0, $pa return setcookie( $name, $value, $options ); } - - static protected function domain() - { - return Domains::getInstance()->getDomain(); - } } diff --git a/test/Sifo/CookieTest.php b/test/Sifo/CookieTest.php index 304d73bd..364a3101 100644 --- a/test/Sifo/CookieTest.php +++ b/test/Sifo/CookieTest.php @@ -25,7 +25,7 @@ public function testCookieIsSetWithExpectedDefaults(): void "Expires doesn't match with expected." ); $this->assertSame( - 'example', + 'sifo.local', TestCookie::getDomain($cookieName), "Domain doesn't match with expected." ); @@ -62,7 +62,7 @@ public function testCookieIsSetWithCustomParameters(): void "Expires doesn't match with expected." ); $this->assertSame( - 'example', + 'sifo.local', TestCookie::getDomain($cookieName), "Domain doesn't match with expected." ); diff --git a/test/Sifo/TestCookie.php b/test/Sifo/TestCookie.php index 1594368c..ffbfd681 100644 --- a/test/Sifo/TestCookie.php +++ b/test/Sifo/TestCookie.php @@ -89,9 +89,4 @@ public static function clearCookies(): void { self::$cookies = []; } - - protected static function domain() - { - return 'example'; - } }