Codeception is a testing framework which is wrapping PHPUnit to get some additional convienience features. Because of the PHPUnit backend it is no problem to use Prophecy. But its not possible to use the autocomplete features of this plugin.
The main difference in Codeception test cases is the naming of the PHPUnit like setUp method. This method is named _before in Codeption.
I think the ChainVisitorUtil have to changed. If the method name _before is treated like a constructor it should work out of the box.
To visualize the feature a bit more look at the following test
class ExampleTest extends Unit
{
use ProphecyTrait;
/** @var MockObject|\Prophecy\Prophecy\ObjectProphecy */
private $mock;
protected function _before(): void
{
$this->mock = $this->prophesize(MockObject::class);
}
public function testMock(): void
{
// Autocomplete will not work
$this->mock->mockFunction(Argument::any())->willReturn('xxx');
// Autocomplete will work
$localMock = $this->prophesize(MockObject::class);
$localMock->mockFunction(Argument::class)->willReturn('xxx');
}
}
Codeception is a testing framework which is wrapping PHPUnit to get some additional convienience features. Because of the PHPUnit backend it is no problem to use Prophecy. But its not possible to use the autocomplete features of this plugin. The main difference in Codeception test cases is the naming of the PHPUnit like
setUp
method. This method is named_before
in Codeption.I think the ChainVisitorUtil have to changed. If the method name
_before
is treated like a constructor it should work out of the box.To visualize the feature a bit more look at the following test