lundi 1 août 2016

Php unit empty array value recieved in zend controller

I am writing an unit test case for my zf2 controller action. But I am stuck in posting the data to controller from unit testcase script.

The test is for login controller action . Login controller is checking for empty username and password. if true it will do the login action steps else redirect to login page.

The problem is I am passing data using the below code to controller. But controller is recieving empty array. I am using php unit version 4.8 and zf2. Is there any alternative way to pass the data(I mean post the data).

$postData = array(
            array('login'  => 'loginusername','password' => 'test')
        );
        $this->dispatch('/login', 'POST', $postData);

Aucun commentaire:

Enregistrer un commentaire