php - Codeigniter Unit testing send file -


i'm using https://github.com/kenjis/ci-phpunit-test unit testing library codeigniter.

i'm new @ writing tests, test how "adding new post" feature working. example send post requests fields , see messages see in view.

public function test_when_you_send_slug_you_do_not_see_message() {      $output = $this->request('post', '/pages/add', [         'slug' => 'not-empty'     ]);      $this->assertnotcontains('<p>the slug field required.</p>', $output);  } 

for example check whether when enter slug in form not specific error message.

the problem can not test case when full form submitted correctly. have these required fields: title, content, slug, featured_image

that last 1 file.

so if pass title, content, slug in request, still missing featured_image file, , can't find information on internet how can pass $_files, cause guess 'post' wont see $_file.

what want ask, how can pass file request? possible? if not, how can test whether form saves images in database ant upload folder?

thank you.


Comments