ApiTestCase icon indicating copy to clipboard operation
ApiTestCase copied to clipboard

PHPUnit constructor deprecation

Open pbowyer opened this issue 4 years ago • 4 comments

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

pbowyer avatar Jun 03 '20 14:06 pbowyer

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.

lchrusciel avatar Jun 04 '20 07:06 lchrusciel

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)

norberttech avatar Feb 23 '21 22:02 norberttech

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

lchrusciel avatar Feb 26 '21 08:02 lchrusciel

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

norberttech avatar Feb 26 '21 09:02 norberttech