~thirdplace/components

6929ab47f9d4b2290617ddd39cd4a7d17be2ee34 — Dag 1 year, 3 months ago fa99978
fix: cookie bug
2 files changed, 11 insertions(+), 1 deletions(-)

M src/http/Cookie.php
A tests/http.php
M src/http/Cookie.php => src/http/Cookie.php +1 -1
@@ 10,6 10,7 @@ final class Cookie

    public static function fromString(string $cookieString): self
    {
        $cookieString = ltrim($cookieString, '; ');
        $parts = explode(';', $cookieString);
        $nameAndValue = explode('=', $parts[0]);



@@ 25,7 26,6 @@ final class Cookie
    public function send(): void
    {
        $options = [

        ];
        setcookie($this->name, $this->value, $options);
    }

A tests/http.php => tests/http.php +10 -0
@@ 0,0 1,10 @@
<?php
declare(strict_types=1);

namespace Thirdplace;

$sut = Cookie::fromString('foo=bar');
assertEquals(['foo', 'bar'], [$sut->name, $sut->value]);

$sut = Cookie::fromString('; foo=bar');
assertEquals(['foo', 'bar'], [$sut->name, $sut->value]);
\ No newline at end of file