Codeception Version 2.1.1
phantomjs Version 2.0.0
Got error
[Codeception\Exception\ConfigurationException]
Module AcceptanceHelper could not be found and loaded
acceptance.suit.yml
class_name: AcceptanceTester
modules:
enabled:
- WebDriver
- AcceptanceHelper
config:
PhpBrowser:
url: 'http://27.0.0.1/simpleApp/'
WebDriver:
url: 'http://27.0.0.1/simpleApp/'
browser: 'phantomjs'
host: '27.0.0.1'
How to fix it?
Change AcceptanceHelper to Helper\Acceptance
This is not resolved. I made the change and nothing in the _support directory is being loaded by Autoload probably because the correct path is never added.
Update: loadMappedFile() in Autoload, is using a prefix that has absolutely zero explaination in the docs. It is like you are trying to use namespaces to load the class name, but then hacking out the directories in between such as _support. The docs do not specify that your AcceptanceHelper class is loaded by the namespace of the parents directories excluding everything below your initial Codeception config directory. This need to use the default autoloader that comes from Symfony but I fear anymore changes to this is going to make upgrading miserable for anyone who tries.
I kept getting "Module AcceptanceHelper could not be found and loaded" Because no where in the documentation does it describe that the namespace inherits from the directory structure except for the _support parts defined in the helpers: setting in the codeception.yml file. This custom Autoload script gets called with the prefix of wherever you put your codeception tests:
https://github.com/Codeception/Codeception/blob/e31097051056e26d2d70e23b4df57a0f6f7df1b0/src/Codeception/Util/Autoload.php
Is there a specific place I should be putting my test scripts because right now it is in src/Project/Bundle/Tests
The documentation says the namespace should be:
namespace Helper;
// here you can define custom functions for FunctionalTester
class Functional extends \Codeception\Module
{
}
Turns out, it is actually supposed to be namespace Project\Bundle\Tests;
And the configuration would be:
modules:
enabled:
- Project\Bundle\Tests\AcceptanceHelper
Something changed with the prefix because now it is relative to the top of my src/ directory instead of before where it was relative to wherever my codeception.yml file resides. Also the documentation does not specify that $prefix is used when loading Helpers.
this is shit with errors
yii2 testing is hell
After a few hours of debugging and searching the web I found the answer to my problem at least:
http://phptest.club/t/class-helper-acceptance-does-not-exist/808
In my case, my main-projects's .gitignore had a _* line in it. Because of this the codeception directories had not been committed, and specifically the _support directy containing the requested file.
Removing the _* line from my .gitignore and committing and pulling the files, then fixed the problem.
Hope this helps.
And how the fuck this codeception thing can help me with my coding? On every signle step I get an error.
And it seems that 99% of the people that tries to run it have the same issues ... Can't you make one video tutorial how to configurate it? If it's helpful testing framework - PLEASE show as how to make it helpful for us also .. or maybe it's so shitty only in YIi2 ...
Most helpful comment
yii2 testing is hell