Пример #1
0
 public function testSetGetArrayValue()
 {
     $value = array("this", "is", "a", "sample", "value");
     $cookie = new \Comodojo\Cookies\Cookie('test_cookie');
     $result = $cookie->setValue($value);
     $this->assertInstanceOf('\\Comodojo\\Cookies\\Cookie', $cookie);
     $result = $cookie->getValue();
     $this->assertEquals($value, $result);
 }
Пример #2
0
 public function testManagerGetValues()
 {
     $cookie1 = new \Comodojo\Cookies\Cookie('test_cookie_1');
     $cookie1->setValue('value1');
     $cookie2 = new \Comodojo\Cookies\Cookie('test_cookie_2');
     $cookie2->setValue('value2');
     $manager = new \Comodojo\Cookies\CookieManager();
     $manager->register($cookie1)->register($cookie2);
     $result = $manager->getValues();
     $this->assertInternalType('array', $result);
     $this->assertArrayHasKey("test_cookie_1", $result);
     $this->assertArrayHasKey("test_cookie_2", $result);
     $this->assertEquals('value1', $result['test_cookie_1']);
     $this->assertEquals('value2', $result['test_cookie_2']);
 }