unit testing - Method with argument of AbstractController phpunit. Any hints -


i need test method looks this, question is: how should enter method when can not "mock" abstractcontroller, , without variable of abstractcontroller not work

public function add(\queue\controller\abstractqueuecontroller $task)  {        //logic of method          } 

you don't need mock it. set parameter, test not testing abstractqueuecontroller.

so, example, if function looks :

public function add(\queue\controller\abstractqueuecontroller $task)  {    $task->dosomething(); } 

then, in test,abstractqueuecontroller should receive call dosomething method(), , assert result of that.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -