如何为类代码编写单元测试?
我编写测试时也遇到此错误
“ session_start():标头已发送时无法启动会话”
class Cookie
{
function __construct()
{
session_start();
}
public static function isthere($name)
{
return (isset($_COOKIE[$name])) ? true : false;
}
public static function get($name)
{
return $_COOKIE[$name];
}
public static function create($name,$valu,$time)
{
if(setcookie($name,$valu,time() + $time,'/')){
return true;
}else{
return false;
}
}
public static function delete($name)
{
self::create($name,'',time()-1);
}
}