-
Notifications
You must be signed in to change notification settings - Fork 67
SymfonyMailerContext #112
base: refactoring/new-extension
Are you sure you want to change the base?
SymfonyMailerContext #112
Conversation
umpirsky
commented
Oct 25, 2014
- @then no email should have been sent
- @then email with subject :subject should not be sent
- @then email should not be sent to :recipient
- @then email with subject :subject should not be sent to :recipient
- @then the following emails should not be sent:
- @then :count emails should have been sent
- @then email with subject :subject should have been sent
- @then email should have been sent to :recipient
- @then email with subject :subject should have been sent to :recipient
- @then the following emails should have been sent:
@PedroTroller I would like to add context class and write scenarios. But I am afraid I will need almost full symfony app, with container, kernel and everything. What do you think? |
I think we need somthink like the fixture APP into KnpRevealsBundle : https://github.com/KnpLabs/KnpRevealBundle/tree/master/features/fixtures |
|
||
protected function getCollector() | ||
{ | ||
return $this->get('swiftmailer')->getCollector('swiftmailer'); |
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.
No, in fact you can't get a service with() get
method. This method allow you to call others helpers.
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.
Ah, 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.
If you want to get the profiler
service, you can describe the service like that :
https://github.com/KnpLabs/FriendlyContexts/blob/refactoring/new-extension/src/Knp/FriendlyExtension/Resources/config/symfony.yml
👍 |
What's about when sending an email and then immediately redirecting to another page ?? Using MinkRedirectContext is an alternative but I guess you have another better solution :) |
@aitboudad Yes. I also submitted some improvements in Behat/CommonContexts#54 but they never merge. |
14f8c77
to
b27924c
Compare
25f4313
to
b28a1c3
Compare
@PedroTroller Feedback is appreciated. |
@umpirsky could you add a little bit of docs? Then we can merge it - personally I like it. |
@akovalyov I was waiting for some @PedroTroller feedback. |
@PedroTroller could you give any feedback on this cool work? :) |
+1 |
Scenario: No emails sent | ||
When I go to the noEmails page | ||
Then no email should have been sent | ||
And 0 emails should have been sent |
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.
0 email
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 think it's 0 emails. :)
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.
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.
@cursedcoder I think your link is about saying "zeros" or "zeroes" and not how to accord the noun after zero. But maybe I'm missing something.
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.
Anyway, @umpirsky seems right on this one ;) http://english.stackexchange.com/a/13075
Is this still up to date? |
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 PR could have significant improvements. It forces to enable the profiler to collect in test environment, what could seriously impact test suite performance. Maybe we could provide a configurable implementation where the user could configure its own email provider (I think the user may prefer check headers or spool ?).
Otherwise, I think this project really needs more functional tests. Those of Behat are a great source of inspiration to write them.
use Symfony\Component\HttpKernel\Kernel; | ||
use Symfony\Component\Config\Loader\LoaderInterface; | ||
|
||
class AppKernel extends Kernel |
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 should be done with the micro kernel :) .