Skip to content

Replaced PHPMatcher facade with implementation that makes possible to access backtrace #186

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

Merged
merged 4 commits into from
Nov 25, 2019

Conversation

norberttech
Copy link
Member

PHPMatcher API cleanup that replaces facade with regular class allowing to access last message/backtrace.

Changes

Creating Matcher:

-$factory = new MatcherFactory();
-$matcher = $factory->createMatcher();
+$matcher = new PHPMatcher();

Using Matcher

-PHPMatcher::match($value, $pattern, $error)
+$matcher = (new PHPMatcher())->match($value, $pattern);;

Accessing last error/backtrace

+$matcher = new PHPMatcher();
+$matcher->match($value, $pattern);
+echo $matcher->error();
+echo $matcher->backtrace();

@norberttech norberttech added this to the 4.0.0 milestone Nov 23, 2019
@norberttech norberttech force-pushed the feature/bactrace-improvemens branch from 3d6fa43 to 31a8577 Compare November 23, 2019 14:48
@norberttech
Copy link
Member Author

@lchrusciel could you please check if those changes are not going to impact https://github.com/lchrusciel/ApiTestCase too hard?

@lchrusciel
Copy link

I will take a look, but we should be fine.

@norberttech norberttech merged commit 51f7c8d into coduo:master Nov 25, 2019
@norberttech norberttech deleted the feature/bactrace-improvemens branch November 25, 2019 11:18
@norberttech
Copy link
Member Author

Let me know if you notice anything that could be hard to upgrade, I'm merging it for now, thanks!

@lchrusciel
Copy link

Just to confirm, it's about ~20 lines to make it work on my side. Thanks a lot! Do you have plans to release a new version? I will probably work on ApiTestCase in mid-December.

@norberttech
Copy link
Member Author

Awesome, I was just waiting for you to confirm that it works, I think I'm going to release it next week - need to check everything one more time and I think we gonna be good to go

@lchrusciel
Copy link

lchrusciel commented Nov 29, 2019

The current output is really verbose, but I didn't have time to dive deeply and make it nicer: https://travis-ci.org/lchrusciel/ApiTestCase/jobs/618384619#L513

I guess it is just a matter of configuration, some tweaks, or better usage. Tl;dr: it works ;)

Current implementation: https://github.com/lchrusciel/ApiTestCase/pull/164/files

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

Successfully merging this pull request may close these issues.

2 participants