Skip to content
This repository was archived by the owner on Apr 8, 2024. It is now read-only.

Commit c07b936

Browse files
authored
Merge pull request #38 from spinen/feature/SPINEN-36
Feature/spinen 36
2 parents 5c396e9 + 387cd2f commit c07b936

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/MailTracking.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ trait MailTracking
4848
*/
4949
public function setUpMailTracking()
5050
{
51-
Mail::getSwiftMailer()
52-
->registerPlugin(new MailRecorder($this));
51+
$this->afterApplicationCreated(function () {
52+
Mail::getSwiftMailer()
53+
->registerPlugin(new MailRecorder($this));
54+
});
5355
}
5456

5557
/**

tests/Stubs/MailTrackingStub.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ class MailTrackingStub extends PHPUnit_Framework_TestCase
1414
{
1515
use MailTracking;
1616

17+
/**
18+
* Stubs Laravel's afterApplicationCreated() method so that tests can run normally
19+
*
20+
* @param callable $callback
21+
*
22+
* @return void
23+
*/
24+
public function afterApplicationCreated(callable $callback)
25+
{
26+
call_user_func($callback);
27+
}
28+
1729
/**
1830
* Public method in the stub to expose the protected email collection
1931
*

0 commit comments

Comments
 (0)