-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[RFC][DX] Introduce NotificationChecker #4622
[RFC][DX] Introduce NotificationChecker #4622
Conversation
@@ -30,6 +30,7 @@ | |||
<parameter key="sylius.behat.page.admin.crud.create.class">Sylius\Behat\Page\Admin\Crud\CreatePage</parameter> | |||
<parameter key="sylius.behat.page.admin.crud.update.class">Sylius\Behat\Page\Admin\Crud\UpdatePage</parameter> | |||
<parameter key="sylius.behat.service.accessor.notification_accessor.class">Sylius\Behat\Service\Accessor\NotificationAccessor</parameter> | |||
<parameter key="sylius.behat.service.notification_validator.class">Sylius\Behat\Service\NotificationValidator</parameter> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should be consistent and name these:
sylius.behat.service.accessor.notification
sylius.behat.service.validator.notification
?
Or maybe name this... Asserter!!! 😈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO sylius.behat.service.notification_{validator,accessor}
seems the best for me, as grouping them by accessor / validator doesn't really help - I need a notification validator, not a validator for notifications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for services names. Asserter doesn't sound good for me 😄 I would leave Validator :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for name - asserter / validator - the verb used in the interface suggests that it's a notification checker :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asserter was a joke, but I am +1 for Checker. Validator can be confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for Checker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
{ | ||
$this->assertPositiveMessage(); | ||
|
||
Assert::true( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a custom exception?
a3ed087
to
4e98449
Compare
|
||
namespace Sylius\Behat\Exception; | ||
|
||
use Exception; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's needed.
f85739f
to
ccfdcf4
Compare
\Exception $previous = null | ||
) { | ||
$message = sprintf( | ||
"Expected *%s* notification with a \"%s\" message was not found.\n *%s* notification with a \"%s\" message has been founded.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has been found
instead of has been founded
no ?
ccfdcf4
to
b730b83
Compare
@@ -25,6 +25,7 @@ | |||
<parameter key="sylius.behat.mocker.class">Sylius\Behat\Service\Mocker\Mocker</parameter> | |||
<parameter key="sylius.behat.response_loader.class">Sylius\Behat\Service\ResponseLoader</parameter> | |||
<parameter key="sylius.behat.notification_accessor.class">Sylius\Behat\Service\Accessor\NotificationAccessor</parameter> | |||
<parameter key="sylius.behat.service.notification_checker.class">Sylius\Behat\Service\NotificationChecker</parameter> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other PR you removed "service" prefix. I agree.
👍 |
Just a thought. Because of usage of NotificationAccessor we had to duplicate some line, so I just extracted it to separated service, just to keep DRY. I haven't coupled it with NotificationAccessor, because it can be useful somewhere else and writing test for it is pretty painful also.
Edit
After introducing new Exception output for developer will look like this: