mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-04-24 09:24:10 +02:00
Merge branch 'ConnorVG-mail-testing' into 2.4
This commit is contained in:
commit
628833a73f
@ -15,7 +15,6 @@ use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasUpdatedEvent;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use Illuminate\Contracts\Mail\MailQueue;
|
||||
use Illuminate\Mail\Message;
|
||||
use McCool\LaravelAutoPresenter\Facades\AutoPresenter;
|
||||
|
||||
class SendComponentUpdateEmailNotificationHandler
|
||||
@ -111,7 +110,7 @@ class SendComponentUpdateEmailNotificationHandler
|
||||
$this->mailer->queue([
|
||||
'html' => 'emails.components.update-html',
|
||||
'text' => 'emails.components.update-text',
|
||||
], $mail, function (Message $message) use ($mail) {
|
||||
], $mail, function ($message) use ($mail) {
|
||||
$message->to($mail['email'])->subject($mail['subject']);
|
||||
});
|
||||
}
|
||||
|
@ -53,7 +53,8 @@
|
||||
"mockery/mockery": "0.9.5",
|
||||
"phpunit/phpunit": "4.8.21",
|
||||
"symfony/css-selector": "^3.0",
|
||||
"symfony/dom-crawler": "^3.0"
|
||||
"symfony/dom-crawler": "^3.0",
|
||||
"tightenco/mailthief": "^0.2.3"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
|
45
composer.lock
generated
45
composer.lock
generated
@ -4,8 +4,8 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "1e913bd58bbbc4f626d0418762dcfd5a",
|
||||
"content-hash": "a9bffd0764d483e1b33ed9f0fc1302ce",
|
||||
"hash": "beb947157999db1d55d9af092dd81f37",
|
||||
"content-hash": "89a23d2b2505160bda9ead17b9b0c0d4",
|
||||
"packages": [
|
||||
{
|
||||
"name": "alt-three/badger",
|
||||
@ -5619,6 +5619,47 @@
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-09-25 08:27:07"
|
||||
},
|
||||
{
|
||||
"name": "tightenco/mailthief",
|
||||
"version": "v0.2.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tightenco/mailthief.git",
|
||||
"reference": "274d4129ad8ad80cd122ab5448f31f1bb554fa8a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/tightenco/mailthief/zipball/274d4129ad8ad80cd122ab5448f31f1bb554fa8a",
|
||||
"reference": "274d4129ad8ad80cd122ab5448f31f1bb554fa8a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/mail": "^5.1",
|
||||
"illuminate/view": "^5.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^0.9.5",
|
||||
"phpunit/phpunit": "^5.4"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"MailThief\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Adam Wathan",
|
||||
"email": "adam.wathan@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A fake Mailer for Laravel applications that takes the pain out of testing mail.",
|
||||
"time": "2016-08-03 17:38:40"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
"version": "1.1.0",
|
||||
|
@ -13,6 +13,8 @@ namespace CachetHQ\Tests\Cachet\Bus\Events\Component;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasUpdatedEvent;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use MailThief\Testing\InteractsWithMail;
|
||||
|
||||
/**
|
||||
* This is the component status was updated event test.
|
||||
@ -21,6 +23,31 @@ use CachetHQ\Cachet\Models\Component;
|
||||
*/
|
||||
class ComponentStatusWasUpdatedEventTest extends AbstractComponentEventTestCase
|
||||
{
|
||||
use DatabaseMigrations, InteractsWithMail;
|
||||
|
||||
public function testComponentUpdateEmailWasSent()
|
||||
{
|
||||
$component = factory('CachetHQ\Cachet\Models\Component')->create([
|
||||
'status' => 2,
|
||||
]);
|
||||
|
||||
$subscriber = factory('CachetHQ\Cachet\Models\Subscriber')->create([
|
||||
'verified_at' => '1970-01-01 00:00:00',
|
||||
]);
|
||||
|
||||
$subscriber->subscriptions()->create(['component_id' => $component->id]);
|
||||
|
||||
$this->app['events']->fire(new ComponentStatusWasUpdatedEvent($component, 1, 2));
|
||||
|
||||
$this->seeMessageFor($subscriber->email);
|
||||
$this->seeMessageWithSubject(trans('cachet.subscriber.email.component.subject'));
|
||||
|
||||
$message = $this->getMailer()->lastMessage();
|
||||
|
||||
$this->assertTrue($message->contains($component->name));
|
||||
$this->assertTrue($message->contains(trans('cachet.components.status.'.$component->status)));
|
||||
}
|
||||
|
||||
protected function objectHasHandlers()
|
||||
{
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user