I have the following uploadform model
class TestUploadForm extends CFormModel
{
public $test;
public function rules()
{
return array(
array(test, 'file', 'types' => 'zip, rar'),
);
}
My Question is, how can I unit test this? I've tried something like:
public $testFile = 'fixtures/files/yii-1.1.0-validator-cheatsheet.pdf';
public function testValidators()
{
$testUpload = new TestUploadForm;
$testUpload->test = $this->testFile ;
assertTrue($testUpload ->validate());
$errors= $testUpload ->errors;
assertEmpty($errors);
}
However, That keeps telling me the field hasn't been filled in. How can I properly unit test the extension rules?
documentfield supposed to be? and why haven't you set the $test field?documentfield a string?