Open tbreuss opened 2 years ago
Tried it also with ApiTester actor.
actor: ApiTester
modules:
enabled:
- REST:
url: http://serviceapp/api/v1/
depends: PhpBrowser
- ApiValidator:
depends: REST
schema: '/openapi/openapi.v1.yaml'
- \Helper\Api
Is failing when trying to php vendor/bin/codecept run
, too.
The error is about the same like above.
FATAL ERROR. TESTS NOT FINISHED.
Uncaught ArgumentCountError: Too few arguments to function Codeception\Module\ApiValidator::_inject(), 1 passed and exactly 2 expected in /app/vendor/awuttig/codeception-api-validator/src/ApiValidator.php:139
Stack trace:
#0 [internal function]: Codeception\Module\ApiValidator->_inject(Object(Codeception\Module\REST))
#1 /app/vendor/codeception/codeception/src/Codeception/Lib/ModuleContainer.php(380): call_user_func_array(Array, Array)
#2 /app/vendor/codeception/codeception/src/Codeception/Lib/ModuleContainer.php(132): Codeception\Lib\ModuleContainer->injectModuleDependencies('ApiValidator', Object(Codeception\Module\ApiValidator))
#3 /app/vendor/codeception/codeception/src/Codeception/SuiteManager.php(70): Codeception\Lib\ModuleContainer->create('ApiValidator')
#4 /app/vendor/codeception/codeception/src/Codeception/Codecept.php(203): Codeception\SuiteManager->__construct(Object(Symfony\Component\EventDispatcher\EventDispatcher), 'api', Array)
#5 /app/vendor/codeception/codeception/src/Codeception/Codecept.ph
in /app/vendor/awuttig/codeception-api-validator/src/ApiValidator.php:139
@tbreuss I was able to fix it by defining an extra (required) dependency: [REST, PhpBrowser] or in my case [REST, Laravel]
actor: AcceptanceTester
modules:
enabled:
- PhpBrowser:
url: &url 'http://localhost/api/'
- REST:
depends: PhpBrowser
url: *url
shortDebugResponse: 300
- ApiValidator:
depends: [REST, PhpBrowser]
schema: '/openapi/openapi.v1.yaml'
step_decorators: ~
or with the ApiTester actor:
actor: ApiTester
modules:
enabled:
- PhpBrowser:
url: &url 'http://serviceapp/api/v1/'
- REST:
depends: PhpBrowser
url: *url
- ApiValidator:
depends: [REST, PhpBrowser]
schema: '/openapi/openapi.v1.yaml'
- \Helper\Api
@addow Great, thanks. I will try this the next days.
Trying to test with your package fails with the following fatal error.
My codeception setup is:
My relevant composer packages are:
And I'm running PHP 7.4.