#!/usr/bin/env php new Cookie_Crypt_Mock(), 'key' => 'aha~'); $this->phalApiCookieMulti = new PhalApi_Cookie_Multi($config); } protected function tearDown() { } /** * @group testGet */ public function testGet() { $name = NULL; $rs = $this->phalApiCookieMulti->get($name); $this->assertTrue(is_array($rs)); } /** * @group testSet */ public function testSet() { $name = 'aEKey'; $value = '2015'; $expire = $_SERVER['REQUEST_TIME'] + 10; $rs = @$this->phalApiCookieMulti->set($name, $value, $expire); //remember $this->assertEquals($value, $this->phalApiCookieMulti->get($name)); } /** * @group testDelete */ public function testDelete() { $name = 'aEKey'; $value = '2015'; $expire = $_SERVER['REQUEST_TIME'] + 10; $rs = @$this->phalApiCookieMulti->set($name, $value, $expire); $this->assertNotEmpty($this->phalApiCookieMulti->get($name)); $rs = @$this->phalApiCookieMulti->delete($name); $this->assertNull($this->phalApiCookieMulti->get($name)); } } class Cookie_Crypt_Mock implements PhalApi_Crypt { public function encrypt($data, $key) { return base64_encode($data); } public function decrypt($data, $key) { return base64_decode($data); } }