Esempio n. 1
0
 public function setCookie($name, $value, $expire = 0, $path = '/', $domain = null, $secure = false, $httponly = true)
 {
     \Test\Mock\Cookie::getInstance()->set($name, $value, $expire, $path, $domain, $secure, $httponly);
 }
Esempio n. 2
0
 protected function __construct()
 {
     $this->cookie = \Test\Mock\Cookie::getInstance();
     $this->_server = $_SERVER;
 }
Esempio n. 3
0
 public function testBindIpCookieContext()
 {
     $mock_cookie = \Test\Mock\Cookie::getInstance();
     $mock_cookie->reset();
     $config = array('token' => 'test', 'sign_salt' => 'fdajkfldsjfldsf', 'bind_ip' => true);
     $_SERVER['REMOTE_ADDR'] = '192.168.1.1';
     $handler = new \Lysine\CookieContextHandler($config);
     $handler->set('test', 'abc');
     $mock_cookie->apply();
     $handler->reset();
     $_SERVER['REMOTE_ADDR'] = '192.168.1.3';
     $this->assertEquals($handler->get('test'), 'abc', '同子网IP取值');
     $handler->reset();
     $_SERVER['REMOTE_ADDR'] = '192.168.2.1';
     $this->assertNull($handler->get('test'), '不同子网IP取值');
 }