Skip to content

Commit

Permalink
Merge pull request #4 from CachetHQ/2.4
Browse files Browse the repository at this point in the history
Update from upstream repo CachetHQ/Cachet
  • Loading branch information
billmn committed Oct 4, 2016
2 parents ff84a6d + 628833a commit e1611e4
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
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
Expand Down Expand Up @@ -111,7 +110,7 @@ public function notify(Component $component, Subscriber $subscriber)
$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']);
});
}
Expand Down
4 changes: 2 additions & 2 deletions app/Composers/Modules/ComponentsComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Illuminate\Contracts\View\View;

/**
* This is the status page composer.
* This is the components composer.
*
* @author James Brooks <[email protected]>
* @author Connor S. Parks <[email protected]>
Expand All @@ -44,7 +44,7 @@ public function __construct(Guard $guard)
}

/**
* Index page view composer.
* Bind data to the view.
*
* @param \Illuminate\Contracts\View\View $view
*
Expand Down
10 changes: 8 additions & 2 deletions app/Composers/Modules/MetricsComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
use Illuminate\Contracts\Config\Repository;
use Illuminate\Contracts\View\View;

/**
* This is the metrics composer.
*
* @author James Brooks <[email protected]>
* @author Connor S. Parks <[email protected]>
*/
class MetricsComposer
{
/**
Expand All @@ -25,7 +31,7 @@ class MetricsComposer
protected $config;

/**
* Create a new metrics composer.
* Create a new metrics composer instance.
*
* @param \Illuminate\Contracts\Config\Repository $config
*
Expand All @@ -37,7 +43,7 @@ public function __construct(Repository $config)
}

/**
* Metrics view composer.
* Bind data to the view.
*
* @param \Illuminate\Contracts\View\View $view
*
Expand Down
4 changes: 2 additions & 2 deletions app/Composers/Modules/ScheduledComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
use Illuminate\Contracts\View\View;

/**
* This is the status page composer.
* This is the scheduled composer.
*
* @author James Brooks <[email protected]>
* @author Connor S. Parks <[email protected]>
*/
class ScheduledComposer
{
/**
* Index page view composer.
* Bind data to the view.
*
* @param \Illuminate\Contracts\View\View $view
*
Expand Down
6 changes: 3 additions & 3 deletions app/Composers/Modules/StatusComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Illuminate\Contracts\View\View;

/**
* This is the status page composer.
* This is the status composer.
*
* @author James Brooks <[email protected]>
* @author Connor S. Parks <[email protected]>
Expand All @@ -30,7 +30,7 @@ class StatusComposer
protected $system;

/**
* Create a new status page composer instance.
* Create a new status composer instance.
*
* @param \CachetHQ\Cachet\Integrations\Contracts\System $system
*
Expand All @@ -42,7 +42,7 @@ public function __construct(System $system)
}

/**
* Index page view composer.
* Bind data to the view.
*
* @param \Illuminate\Contracts\View\View $view
*
Expand Down
4 changes: 2 additions & 2 deletions app/Composers/Modules/StickiedComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Illuminate\Contracts\View\View;

/**
* This is the status page composer.
* This is the stickied composer.
*
* @author James Brooks <[email protected]>
* @author Connor S. Parks <[email protected]>
Expand All @@ -25,7 +25,7 @@
class StickiedComposer
{
/**
* Index page view composer.
* Bind data to the view.
*
* @param \Illuminate\Contracts\View\View $view
*
Expand Down
4 changes: 2 additions & 2 deletions app/Composers/Modules/TimelineComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
use Illuminate\Contracts\View\View;

/**
* This is the status page composer.
* This is the timeline composer.
*
* @author James Brooks <[email protected]>
* @author Connor S. Parks <[email protected]>
*/
class TimelineComposer
{
/**
* Index page view composer.
* Bind data to the view.
*
* @param \Illuminate\Contracts\View\View $view
*
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
81 changes: 61 additions & 20 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions tests/Bus/Events/Component/ComponentStatusWasUpdatedEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

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.
Expand All @@ -21,6 +23,31 @@
*/
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;
Expand Down

0 comments on commit e1611e4

Please sign in to comment.