This question already has an answer here:

I'm using phpunit and need to test the method in a controller but when I try to call it like this:


phpunit fails with this error:

PHP Fatal Error: Class Vendor_Module_Adminhtml_SomecontrollerController not found in ...

Anyone knows how to call to a method in a controller?


marked as duplicate by Rakesh Jesadiya, Raphael at Digital Pianism, Community Feb 21 '17 at 13:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Alan Storm got the response here: https://magento.stackexchange.com/a/8751/49865

Basically add the file and instantiate the class.

In my case look like this:


require_once 'vendor/module/controllers/Adminhtml/myClassController.php';

class vendor_module_controllers_Adminhtml_myClassControllerTest extends PHPUnit_Framework_TestCase
     * @runInSeparateProcess
    public function testOne()
        $controller = new vendor_module_Adminhtml_myClassController(

Not the answer you're looking for? Browse other questions tagged or ask your own question.