-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[RFC] [Tests] use assertions anywhere in the code and profile them #18411
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
Comments
FYI, I'm working on a micro bundle already. If it does not have its place in core, it may help in community projects willing to make functional tests. |
Thanks @HeahDude ! |
Working on an implementation and the dependencies always makes things clear, I will update the API proposed in the op shortly :) |
I don't think this needs to be in core. |
I agree its not needed as part of the core but that would be cool to bring |
I'm not strongly against this ... but I agree with @stof reasons. So this would be a 👎 for me. |
What about collecting assertions in controllers, services, entities ... ?
We can already
dump()
objects but I think this could be useful to have results of assertions directly shown in the profiler and the web debug toolbar.It could be based on
webmozart/assert
(ping @webmozart :)We could use an
assert
service:A controller could get it by
$this->container->get('assert')
and use a trait to hold it as protected parameter and be able to do$this->assert->*
.$assert->*
would be a wrapper for\Webmozart\Assert::
taking the "dumped" context as extra last argument, usingdump
function of the VarDumper component to handsome display in the profiler.It would be nice if the
assert
service wrapper get passed the Stopwatch to check time performances:The
assert
service could handle different channels likeLogger
, to sort them in the profiler.What do you think ?
The text was updated successfully, but these errors were encountered: