forked from tighten/mailthief
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test to prove tighten#81 was actually fixed!
- Loading branch information
Showing
3 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,8 @@ | |
}, | ||
"autoload-dev": { | ||
"classmap": [ | ||
"tests/TestCase.php" | ||
"tests/TestCase.php", | ||
"tests/AppStub.php" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
class AppStub extends \Illuminate\Foundation\Application implements \ArrayAccess | ||
{ | ||
private $foo; | ||
private $mailer; | ||
protected $attributes = []; | ||
|
||
public function setAttributes($attributes) | ||
{ | ||
$this->attributes = $attributes; | ||
} | ||
|
||
public function version() | ||
{ | ||
return 5.4; | ||
} | ||
|
||
public function instance($key, $instance) | ||
{ | ||
$this->attributes[$key] = $instance; | ||
} | ||
|
||
public function offsetExists($offset) | ||
{ | ||
return isset($this->attributes[$offset]); | ||
} | ||
|
||
public function offsetGet($key) | ||
{ | ||
return $this->attributes[$key]; | ||
} | ||
|
||
public function offsetSet($key, $value) | ||
{ | ||
$this->attributes[$key] = $value; | ||
} | ||
|
||
public function offsetUnset($key) | ||
{ | ||
unset($this->attributes[$key]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
use Illuminate\Support\Facades\Mail; | ||
use MailThief\Facades\MailThief; | ||
use MailThief\Testing\InteractsWithMail; | ||
use MailThief\MailThiefFiveFourCompatible; | ||
|
||
class MailFacadeIntegrationTest extends TestCase | ||
{ | ||
use InteractsWithMail; | ||
|
||
public function setUp() | ||
{ | ||
$app = new AppStub; | ||
$app->setAttributes([ | ||
MailThiefFiveFourCompatible::class => $this->getMailThief(), | ||
]); | ||
|
||
Facade::setFacadeApplication($app); | ||
|
||
parent::setUp(); | ||
} | ||
|
||
public function test_previously_set_instance_of_mailthief_doesnt_change() | ||
{ | ||
Mail::send('example-view', [], function ($m) { | ||
$m->to('[email protected]'); | ||
}); | ||
|
||
$this->seeMessageFor('[email protected]'); | ||
|
||
MailThief::swap($this->getMailThief()); | ||
|
||
Mail::send('example-view', [], function ($m) { | ||
$m->to('[email protected]'); | ||
}); | ||
|
||
$this->seeMessageFor('[email protected]'); | ||
} | ||
} |