File tree Expand file tree Collapse file tree 6 files changed +58
-6
lines changed Expand file tree Collapse file tree 6 files changed +58
-6
lines changed Original file line number Diff line number Diff line change 1
- 0.3.0
1
+ 0.3.4
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ NOTE: This is based off a video titled ["Testing Email With Custom Assertions"](
5
5
[ ![ Latest Stable Version] ( https://poser.pugx.org/spinen/laravel-mail-assertions/v/stable )] ( https://packagist.org/packages/spinen/laravel-mail-assertions )
6
6
[ ![ Total Downloads] ( https://poser.pugx.org/spinen/laravel-mail-assertions/downloads )] ( https://packagist.org/packages/spinen/laravel-mail-assertions )
7
7
[ ![ Latest Unstable Version] ( https://poser.pugx.org/spinen/laravel-mail-assertions/v/unstable )] ( https://packagist.org/packages/spinen/laravel-mail-assertions#dev-master )
8
- [ ![ Dependency Status] ( https://gemnasium.com/spinen/laravel-mail-assertions.png )] ( https://gemnasium.com/spinen/laravel-mail-assertions )
8
+ [ ![ Dependency Status] ( https://gemnasium.com/spinen/laravel-mail-assertions.svg )] ( https://gemnasium.com/spinen/laravel-mail-assertions )
9
9
[ ![ License] ( https://poser.pugx.org/spinen/laravel-mail-assertions/license )] ( https://packagist.org/packages/spinen/laravel-mail-assertions )
10
10
11
11
PHPUnit mail assertions for testing email in Laravel.
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ public function setUpMailTracking()
60
60
return ;
61
61
}
62
62
63
- // For PhpUnit 6 and Laravel > 5.1 , register the plugin after the app is booted
63
+ // For PhpUnit 6 and Laravel > 5.2 , register the plugin after the app is booted
64
64
$ this ->afterApplicationCreated (function () use ($ register_plugin ) {
65
65
$ register_plugin ();
66
66
});
Original file line number Diff line number Diff line change @@ -51,9 +51,6 @@ public function it_cannot_be_constructed_without_a_PHPUnit_Framework_TestCase()
51
51
*/
52
52
public function it_cannot_be_constructed_with_class_other_than_a_PHPUnit_Framework_TestCase ()
53
53
{
54
- // TODO: Skipping this until resolving PhpUnit 6 vs. 7 support
55
- $ this ->markTestSkipped ();
56
-
57
54
if (class_exists (TypeError::class)) {
58
55
try {
59
56
new MailRecorder (new StdClass ());
Original file line number Diff line number Diff line change 6
6
use Mockery ;
7
7
use ReflectionClass ;
8
8
use Spinen \MailAssertions \Stubs \MailTrackingStub as MailTracking ;
9
+ use Spinen \MailAssertions \Stubs \OldMailTrackingStub as OldMailTracking ;
9
10
use Swift_Mailer ;
10
11
use Swift_Message ;
11
12
@@ -115,6 +116,33 @@ public function it_registers_MailRecorder_withMail_in_the_setup_with_before_anno
115
116
$ this ->mail_tracking ->setUpMailTracking ();
116
117
}
117
118
119
+ /**
120
+ * @test
121
+ * @group unit
122
+ */
123
+ public function it_registers_MailRecorder_without_afterApplicationCreated_method_present ()
124
+ {
125
+ // Use a version of the MailTrackingStub without the afterApplicationCreated method
126
+ $ this ->mail_tracking = new OldMailTracking ();
127
+
128
+ $ swift_mock = Mockery::mock (Swift_Mailer::class);
129
+
130
+ $ swift_mock ->shouldReceive ('registerPlugin ' )
131
+ ->once ()
132
+ ->with (Mockery::on (function ($ closure ) {
133
+ return is_a ($ closure , MailRecorder::class);
134
+ }))
135
+ ->andReturnNull ();
136
+
137
+ Mail::shouldReceive ('getSwiftMailer ' )
138
+ ->once ()
139
+ ->withNoArgs ()
140
+ ->andReturn ($ swift_mock );
141
+
142
+ // TODO: Get this method name by parsing annotations
143
+ $ this ->mail_tracking ->setUpMailTracking ();
144
+ }
145
+
118
146
/**
119
147
* @test
120
148
* @group unit
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Spinen \MailAssertions \Stubs ;
4
+
5
+ use Spinen \MailAssertions \MailTracking ;
6
+ use Spinen \MailAssertions \TestCase ;
7
+
8
+ /**
9
+ * Class MailTrackingStub
10
+ *
11
+ * @package Spinen\MailAssertions\Stubs
12
+ */
13
+ class OldMailTrackingStub extends TestCase
14
+ {
15
+ use MailTracking;
16
+
17
+ /**
18
+ * Public method in the stub to expose the protected email collection
19
+ *
20
+ * This is only needed in the tests to allow access to the raw collection of messages.
21
+ *
22
+ * @return array
23
+ */
24
+ public function exposeMessage () {
25
+ return $ this ->emails ;
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments