lchrusciel / ApiTestCase

Handy PHPUnit test case for testing JSON APIs in your Symfony applications.
MIT License
410 stars 35 forks source link

PHPUnit constructor deprecation #176

Open pbowyer opened 4 years ago

pbowyer commented 4 years ago

Using PHPUnit 9.1.5 I'm seeing this deprecation notice on every run.

Other deprecation notices (1)

  1x: The "PHPUnit\Framework\TestCase::__construct()" method is considered internal This method is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not extend it from "ApiTestCase\ApiTestCase".

I haven't got a proposed fix, I mean what you do in the constructor seems sensible 🤷‍♂️

See: https://github.com/sebastianbergmann/phpunit/issues/3975

lchrusciel commented 4 years ago

Hey Peter. Thanks for raising an issue. Initialization of PHPMatcher there makes sense, but we may move this logic to some setup method or buildMatcher method. Should be pretty straightforward to fix.

norberttech commented 3 years ago

Hey, can I ask what is the use case for MatcherFactory? In general that class is mostly for building matchers in specific order which is super important when it comes to pattern validation. However, it would be better to actually use PHPMatcher class which reduces requirement to call createMatcher and that exposes public function match($value, $pattern) : bool.

Is there maybe some use case behind MatcherFactory that I'm missing here? I'm totally open to add whatever is needed into PHPMatcher if that could help to drop MatcherFactory which is more a technical class, rather than something that should be used outside of the library.

(I know I might be digging out something old but I finally managed to find some time to properly focus on the matcher)

lchrusciel commented 3 years ago

Consequences of some old refactor, which provided also support for UUIDs: https://github.com/lchrusciel/ApiTestCase/pull/149. And probably we've misused that.

norberttech commented 3 years ago

yeah, matcher comes with the UUID support, I guess you might mark this property as deprecated then?