$this->assertValidationErrors error: Cannot call constructor
lukepass opened this issue · 4 comments
lukepass commented
Preconditions
I am using Symfony 3.4 with the following bundles:
liip/functional-test-bundle 3.1.0 3.1.0 This bundles provides additional functional test-cases fo...
liip/test-fixtures-bundle 1.0.1 1.0.1 This bundles enables efficient loading of Doctrine fixtur...
Steps to reproduce
- Create a class that extends
Liip\FunctionalTestBundle\Test\WebTestCase
- Use the following method:
$this->assertValidationErrors([], $client->getContainer())
Expected result
- The list of validation errors should be shown
Actual result
My code:
public function testRegisterNoInput()
{
$client = $this->makeClient();
$crawler = $client->request(
'POST',
'/api/patients/register'
);
$this->assertIsBadRequestRestApiError($client, ApiResponse::CODE_INVALID_INPUT);
$this->assertValidationErrors([], $client->getContainer());
}
PHPUnit 8.2.4 by Sebastian Bergmann and contributors.
Testing Project Test Suite
E 1 / 1 (100%)
Time: 290 ms, Memory: 36.25 MB
There was 1 error:
1) Tests\AppBundle\Controller\Api\PatientControllerTest::testRegisterNoInput
Error: Cannot call constructor
/vendor/liip/functional-test-bundle/src/Test/ValidationErrorsConstraint.php:33
/vendor/liip/functional-test-bundle/src/Utils/HttpAssertions.php:101
/vendor/liip/functional-test-bundle/src/Test/WebTestCase.php:409
/tests/AppBundle/Controller/Api/PatientControllerTest.php:19
ERRORS!
Tests: 1, Assertions: 5, Errors: 1.
Remaining direct deprecation notices (3)
Remaining indirect deprecation notices (3)
lukepass commented
It seems that the class ValidationErrorsConstraint
is calling parent::__construct()
but Constraint
doesn't have a parent constructor.
alexislefebvre commented
The constructor of PHPUnit\Framework\Constraint
was removed in PHPUnit 8.
The issue will be fixed in #541
sveriger commented
Unfortunately this is still open. @alexislefebvre Why don't you finish your fix?
alexislefebvre commented
Please try the last release: https://github.com/liip/LiipFunctionalTestBundle/releases/tag/3.3.0