Closed Mikk36 closed 2 years ago
Does setting a fully qualified class name in the docblock solve your issue? Please make a pull request.
I can confirm that the issue occurs. When the method Codeception\Module\Yii2::amLoggedInAs()
is annotated with @throws ModuleException
the command codecept build
assembles the FunctionalTesterActions
trait with just the class name. Annotating it with a FQN of the exception assembles the trait with the FQN. No big surprises so far, given that build only copy-pastes the doc block from the module. But it does not copy-paste imports and that is why the ModuleException
is undefined in the traits. Annotating exceptions with FQNs will fix that, I'm preparing a PR.
This was fixed some time ago.
What are you trying to achieve?
Use $I->amLoggedIn without IDE stating that it's throwing a ModuleException while not being able to mitigate it.
What do you get instead?
IDE error stating that ModuleException is undefined.
Details
If an used module (Yii2 -> ModuleException, for example) uses some other classes as input, output or for throwing, those use statements should also be inserted into the generated ...Actions.php file.