Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lib is not compatible with PHP 7.3 #154

Closed
imbpp123 opened this issue Jun 10, 2019 · 4 comments
Closed

Lib is not compatible with PHP 7.3 #154

imbpp123 opened this issue Jun 10, 2019 · 4 comments

Comments

@imbpp123
Copy link

imbpp123 commented Jun 10, 2019

Lib is not compatible with PHP 7.3

Error : Cannot call constructor
 /srv/api/vendor/coduo/php-matcher/src/PHPUnit/PHPMatcherConstraint.php:19
 /srv/api/vendor/coduo/php-matcher/src/PHPUnit/PHPMatcherAssertions.php:18
 /srv/api/vendor/coduo/php-matcher/src/PHPUnit/PHPMatcherAssertions.php:13
 /srv/api/tests/functional/Users/RegisterTest.php:34

    public function testUsersRegisterSuccess($data)
    {
        $response = $this->request('POST', '/users/register', $data);

        $this->assertMatchesPattern('{"http_code":201,"response":{"@context":"\/contexts\/User","@id":"\/users\/424","@type":"User","email":"random@email.com","lastName":"Brawn","firstName":"John","birthDate":"1984-01-15T00:00:00+00:00","phoneNumber":"89375699565","smoker":"no","status":"not_verified","pet":["dog","fish"],"gender":"male","religion":null,"education":null,"groups":[],"profession":null,"countryOfResidence":null,"countryOfBirth":null,"id":424}}', $response);
    }
final class PHPMatcherConstraint extends Constraint
{
    private $pattern;

    private $matcher;

    public function __construct(string $pattern)
    {
        parent::__construct();

        $this->pattern = $pattern;
        $this->matcher = $this->createMatcher();
    }

parent in __construct does not work


Error: Cannot call constructor in /srv/api/vendor/coduo/php-matcher/src/PHPUnit/PHPMatcherConstraint.php on line 19

Call Stack:
    0.0549     399416   1. {main}() /srv/api/vendor/phpunit/phpunit/phpunit:0
    0.0634    1204704   2. PHPUnit\TextUI\Command::main(???) /srv/api/vendor/phpunit/phpunit/phpunit:61
    0.0635    1204816   3. PHPUnit\TextUI\Command->run(???, ???) /srv/api/vendor/phpunit/phpunit/src/TextUI/Command.php:160
    0.1108    3450504   4. PHPUnit\TextUI\TestRunner->doRun(???, ???, ???) /srv/api/vendor/phpunit/phpunit/src/TextUI/Command.php:201
    0.1209    4036992   5. PHPUnit\Framework\TestSuite->run(???) /srv/api/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:619
    0.1292    4039080   6. PHPUnit\Framework\DataProviderTestSuite->run(???) /srv/api/vendor/phpunit/phpunit/src/Framework/TestSuite.php:568
    0.1305    4039640   7. App\Tests\Functional\Users\RegisterTest->run(???) /srv/api/vendor/phpunit/phpunit/src/Framework/TestSuite.php:568
    0.1308    4039640   8. PHPUnit\Framework\TestResult->run(???) /srv/api/vendor/phpunit/phpunit/src/Framework/TestCase.php:823
    0.1319    4051656   9. App\Tests\Functional\Users\RegisterTest->runBare() /srv/api/vendor/phpunit/phpunit/src/Framework/TestResult.php:680
    2.5206   36902456  10. App\Tests\Functional\Users\RegisterTest->runTest() /srv/api/vendor/phpunit/phpunit/src/Framework/TestCase.php:869
    2.5207   36902832  11. App\Tests\Functional\Users\RegisterTest->testUsersRegisterSuccess(???) /srv/api/vendor/phpunit/phpunit/src/Framework/TestCase.php:1192
    5.0228   40668832  12. App\Tests\Functional\Users\RegisterTest->assertMatchesPattern(???, ???, ???) /srv/api/tests/functional/Users/RegisterTest.php:34
    6.6382   40668832  13. App\Functional\AbstractWebTestCase::matchesPattern(???) /srv/api/vendor/coduo/php-matcher/src/PHPUnit/PHPMatcherAssertions.php:13
   11.8812   40692808  14. Coduo\PHPMatcher\PHPUnit\PHPMatcherConstraint->__construct(???) /srv/api/vendor/coduo/php-matcher/src/PHPUnit/PHPMatcherAssertions.php:18

@imbpp123
Copy link
Author

# php --version
PHP 7.3.6 (cli) (built: May 31 2019 23:57:41) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.6, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans

@imbpp123 imbpp123 changed the title Lib is not compatible with PHP 7.2 Lib is not compatible with PHP 7.3 Jun 10, 2019
@norberttech
Copy link
Member

Hey @imbpp123 thanks for reporting this, feel free to open a pull request with required fix.

It also looks that master branch is passing on php 7.3 at travis, https://travis-ci.org/coduo/php-matcher/builds/543486376 - any idea why?

@Guuzen
Copy link
Contributor

Guuzen commented Jun 23, 2019

In my case this error appears when i update phpunit from 7.5.13 to 8.0.0 and i think this bug is related to BC break in phpunit.
Seems like it is fixed already in master branch #148

@norberttech
Copy link
Member

Closing since it might have nothing to do with php-matcher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants