有谁能够帮助我。如何编写文件上传phpunit测试用例?我这样做是为了插入、唯一数据插入、删除等功能。以下是我的代码,但无法正常工作
class FileuploadTest extends PHPUnit_Framework_TestCase
{
public $testFile = array(
'name'=>'2012-04-20 21.13.42.jpg',
'tmp_name'=>'C:\wamp\tmp\php8D20.tmp',
'type'=>'image/jpeg',
'size'=>1472190,
'error'=>0
);
public function testFileupload()
{
$testUpload = new Fileupload;
$testUpload->image = new CUploadedFile($this->testFile['name'],$this->testFile['tmp_name'],$this->testFile['type'],$this->testFile['size'],$this->testFile['error']);
$this->assertFalse($testUpload->validate());
$errors= $testUpload->errors;
$this->assertEmpty($errors);
}
}