lithium\tests\integration\storage\SessionTest::testCookieReadWriteDelete PHP Method

testCookieReadWriteDelete() public method

    public function testCookieReadWriteDelete()
    {
        $this->skipIf(PHP_SAPI === 'cli', 'No headers support in cli SAPI.');
        $config = array('name' => 'cookieInt');
        Session::config(array($config['name'] => array('adapter' => 'Cookie')));
        Session::clear($config);
        $key1 = 'key_one';
        $value1 = 'value_one';
        $key2 = 'key_two';
        $value2 = 'value_two';
        $this->assertNull(Session::read($key1, $config));
        $this->assertTrue(Session::write($key1, $value1, $config));
        $this->assertCookie(array('key' => $key1, 'value' => $value1));
        $this->assertNull(Session::read($key2, $config));
        $this->assertTrue(Session::delete($key1, $config));
        $this->assertCookie(array('key' => $key1, 'value' => 'deleted'));
        $this->assertNoCookie(array('key' => $key2, 'value' => $value2));
        $this->assertNull(Session::read($key1, $config));
    }