-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug that
SetCookie::fromString
cannot not work by invalid typ…
…es. (#6836)
- Loading branch information
1 parent
f96e372
commit 6a7775b
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Hyperf. | ||
* | ||
* @link https://www.hyperf.io | ||
* @document https://hyperf.wiki | ||
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
|
||
namespace HyperfTest\HttpMessage; | ||
|
||
use Hyperf\HttpMessage\Cookie\SetCookie; | ||
use PHPUnit\Framework\Attributes\CoversNothing; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @internal | ||
* @coversNothing | ||
*/ | ||
#[CoversNothing] | ||
class CookieTest extends TestCase | ||
{ | ||
public function testSetCookeFromString() | ||
{ | ||
$cookie = SetCookie::fromString('ltoken_v2=v2_RaLe3_kws2BrlGKF2aqhcCWH7PEybgGpmdcZXcOmEuu3sEgoA==.CAE=; Path=/; Domain=miyoushe.com; Max-Age=31536000; HttpOnly; Secure'); | ||
$this->assertSame(31536000, $cookie->getMaxAge()); | ||
$this->assertIsInt($cookie->getExpires()); | ||
$this->assertTrue($cookie->getSecure()); | ||
} | ||
} |