Skip to content
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

Merged
merged 1 commit into from
Mar 31, 2016

Conversation

lchrusciel
Copy link
Member

Q A
Bug fix? yes
New feature? no
BC breaks? yes
Deprecations? no
Related tickets
License MIT
Doc PR

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:
zrzut ekranu 2016-03-30 o 16 58 05

@@ -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>
Copy link
Member

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!!! 😈

Copy link
Contributor

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.

Copy link
Contributor

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 :)

Copy link
Contributor

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 :)

Copy link
Member

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for Checker

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pjedrzejewski pjedrzejewski added RFC Discussions about potential changes or new features. DX Issues and PRs aimed at improving Developer eXperience. Behat Issues and PRs aimed at improving Behat usage. labels Mar 25, 2016
{
$this->assertPositiveMessage();

Assert::true(
Copy link
Contributor

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?

@lchrusciel lchrusciel force-pushed the notification-validator branch 2 times, most recently from a3ed087 to 4e98449 Compare March 30, 2016 14:15
@lchrusciel lchrusciel changed the title [RFC][DX] Introduce NotificationValidator [RFC][DX] Introduce NotificationChecker Mar 30, 2016

namespace Sylius\Behat\Exception;

use Exception;
Copy link
Member

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.

@lchrusciel lchrusciel force-pushed the notification-validator branch 4 times, most recently from f85739f to ccfdcf4 Compare March 30, 2016 21:19
\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.",
Copy link
Contributor

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 ?

@lchrusciel lchrusciel force-pushed the notification-validator branch from ccfdcf4 to b730b83 Compare March 31, 2016 06:57
@@ -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>
Copy link
Member

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.

@pjedrzejewski pjedrzejewski merged commit 627e0e9 into Sylius:master Mar 31, 2016
@pjedrzejewski
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Behat Issues and PRs aimed at improving Behat usage. DX Issues and PRs aimed at improving Developer eXperience. RFC Discussions about potential changes or new features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants