Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
f1edad0c
Commit
f1edad0c
authored
May 25, 2012
by
Ricard Clau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
following @igorw approach
parent
a238971e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
21 deletions
+16
-21
tests/Silex/Tests/Provider/SwiftmailerServiceProviderTest.php
...s/Silex/Tests/Provider/SwiftmailerServiceProviderTest.php
+16
-21
No files found.
tests/Silex/Tests/Provider/SwiftmailerServiceProviderTest.php
View file @
f1edad0c
...
@@ -49,33 +49,28 @@ class SwiftmailerServiceProviderTest extends \PHPUnit_Framework_TestCase
...
@@ -49,33 +49,28 @@ class SwiftmailerServiceProviderTest extends \PHPUnit_Framework_TestCase
$test
=
$this
;
$test
=
$this
;
/**
$app
->
get
(
'/'
,
function
()
use
(
$app
)
{
* This gets executed before SwiftmailerServiceProvider $app->finish thanks to higher priority
* flushQueue should return 1 if spool has not been flushed
*/
$app
->
finish
(
function
()
use
(
$app
,
$test
)
{
$test
->
assertEquals
(
1
,
$app
[
'swiftmailer.spooltransport'
]
->
getSpool
()
->
flushQueue
(
$app
[
'swiftmailer.transport'
]));
/**
* We add a new message that should be flushed with $app->finish()
*/
$app
[
'mailer'
]
->
send
(
\Swift_Message
::
newInstance
());
$app
[
'mailer'
]
->
send
(
\Swift_Message
::
newInstance
());
}
,
1
);
});
/**
/**
* This gets executed after SwiftmailerServiceProvider $app->finish thanks to higher priority
* Checks spool is empty before process
* flushQueue should return 0 even having added a message in method above
*/
*/
$app
->
finish
(
function
()
use
(
$app
,
$test
)
{
$test
->
assertEquals
(
0
,
$app
[
'swiftmailer.spooltransport'
]
->
getSpool
()
->
flushQueue
(
$app
[
'swiftmailer.transport'
]));
$test
->
assertEquals
(
0
,
$app
[
'swiftmailer.spooltransport'
]
->
getSpool
()
->
flushQueue
(
$app
[
'swiftmailer.transport'
]));
},
-
1
);
$app
->
get
(
'/'
,
function
()
use
(
$app
)
{
$app
[
'mailer'
]
->
send
(
\Swift_Message
::
newInstance
());
return
new
SendMailsResponse
(
'should send e-mails'
);
});
$request
=
Request
::
create
(
'/'
);
$request
=
Request
::
create
(
'/'
);
$app
->
run
(
$request
);
$app
->
handle
(
$request
);
/**
* Checks spool has the message that is sent in controller and regenerates it
*/
$test
->
assertEquals
(
1
,
$app
[
'swiftmailer.spooltransport'
]
->
getSpool
()
->
flushQueue
(
$app
[
'swiftmailer.transport'
]));
$app
[
'mailer'
]
->
send
(
\Swift_Message
::
newInstance
());
/**
* Terminates app and checks that spool is empty
*/
$app
->
terminate
(
$request
,
new
SendMailsResponse
(
'should send e-mails'
));
$test
->
assertEquals
(
0
,
$app
[
'swiftmailer.spooltransport'
]
->
getSpool
()
->
flushQueue
(
$app
[
'swiftmailer.transport'
]));
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment