Module does not exist


I’m trying to test my API with Codeception using REST module.

Any request like this:

$I->sendPOST('/foo/bar/create', [

    'name' => 'Cyril',

    'email' => 'email at example dot com'


gives me the error:

[ReflectionException] Class api\modules\foo\Module does not exist

Notice that api\modules\foo\Module.php do exist and url that outputs verbose mode (-vvv) works fine if I try to test it manually.

Any ideas?



I figured out that when I run my tests using PhpBrowser instead of Yii2 they run fine.

The thing is REST module requires an additional module that provides a method of requesting your API. According to the docs it may be PhpBrowser or any framework module.