I am trying to add a custom helper method to unit test suite, but when running the test I get Fatal error: Uncaught ArgumentCountError: Too few arguments to function error.
This is what I have so far
- Adding the method to _support/Helper/Unit.php
- Running the build command
- Setup actor in suite.yml
- Calling the method via the actor
- Running test
When I run the test I get:
ArgumentCountError: Too few arguments to function ExampleTest::__construct(), 0
_support/Helper/Unit.php:
namespace Helper;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class Unit extends \Codeception\Module
{
public function get_hello()
{
return 'Hello';
}
}
Test method:
public function testMe1(\UnitTester $I)
{
$hello = $I->get_hello();
$this->assertEquals(2, $hello);
}
# Codeception Test Suite Configuration
#
# Suite for unit (internal) tests.
class_name: UnitTester
modules:
enabled:
- Asserts
- \Helper\Unit
Why doesn't testme1() accept any arguments? What step am I missing?