title: Yii - Model Unittesting an upload form
body: <p>I have the following uploadform model</p>
  
  <pre><code>class TestUploadForm extends CFormModel
  {
  public $test;
  
  public function rules()
  {
      return array(
          array(test, 'file', 'types' =&gt; 'zip, rar'),
      );
  }
  </code></pre>
  
  <p>My Question is, how can I unit test this? I've tried something like:</p>
  
  <pre><code>public $testFile = 'fixtures/files/yii-1.1.0-validator-cheatsheet.pdf';
  
  public function testValidators()
  {
      $testUpload = new TestUploadForm;
  
      $testUpload-&gt;test = $this-&gt;testFile ;
      assertTrue($testUpload -&gt;validate());
  
      $errors= $testUpload -&gt;errors;
      assertEmpty($errors);
  }
  </code></pre>
  
  <p>However, That keeps telling me the field hasn't been filled in. How can I properly unit test the extension rules?</p>