예제 #1
0
파일: Response.php 프로젝트: lryl/Lysine2
 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);
 }
예제 #2
0
파일: Sandbox.php 프로젝트: lryl/Lysine2
 protected function __construct()
 {
     $this->cookie = \Test\Mock\Cookie::getInstance();
     $this->_server = $_SERVER;
 }
예제 #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取值');
 }