lundi 4 septembre 2017

PHPUnit: Mocking a method that takes in an array

So I am new to phpunit testing and what I am trying to do is test for a method called "returnOnLogin" that has parameter "Enlight_Event_EventArgs $args" and returns true.

public function returnOnLogin(\Enlight_Event_EventArgs $args){

        $controller = $args->get('subject');
        $view = $controller->View();

        $controller->redirect([
            'controller' => 'verification'
        ]);

//        $view->addTemplateDir(
//            __DIR__ . '/Views'
//        );

        return true;
    }

class MyFirstTestPluginTest extends TestCase
{
    public function testReturnOnLogin(){
        $my_plugin = new MyFirstTestPlugin(true);
        $expected = true;

Aucun commentaire:

Enregistrer un commentaire