Skip to content

Commit

Permalink
Merge branch 'updates' of https://github.com/beyondcode/helo-laravel
Browse files Browse the repository at this point in the history
…into updates
  • Loading branch information
mechelon committed Feb 23, 2024
2 parents 7e8d6bc + 550efcf commit a2f3571
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
21 changes: 15 additions & 6 deletions src/CreatesMailers.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ protected function createLaravel6Mailer($app)
// on the mailer. This allows us to resolve mailer classes via containers
// for maximum testability on said classes instead of passing Closures.
$mailer = new Mailer(
$app['view'], $app['swift.mailer'], $app['events']
$app['view'],
$app['swift.mailer'],
$app['events']
);

if ($app->bound('queue')) {
Expand Down Expand Up @@ -45,7 +47,10 @@ protected function createLaravel7Mailer($app)
// on the mailer. This allows us to resolve mailer classes via containers
// for maximum testability on said classes instead of passing Closures.
$mailer = new Laravel7Mailer(
'smtp', $app['view'], $swiftMailer, $app['events']
'smtp',
$app['view'],
$swiftMailer,
$app['events']
);

if ($app->bound('queue')) {
Expand Down Expand Up @@ -78,7 +83,10 @@ protected function createLaravel9Mailer($app)
// on the mailer. This allows us to resolve mailer classes via containers
// for maximum testability on said classes instead of passing Closures.
$mailer = new Laravel7Mailer(
'smtp', $app['view'], $symfonyTransport, $app['events']
'smtp',
$app['view'],
$symfonyTransport,
$app['events']
);

if ($app->bound('queue')) {
Expand All @@ -105,9 +113,10 @@ protected function getConfig($name = 'smtp')
/**
* Set a global address on the mailer by type.
*
* @param \Illuminate\Mail\Mailer $mailer
* @param array $config
* @param string $type
* @param \Illuminate\Mail\Mailer $mailer
* @param array $config
* @param string $type
*
* @return void
*/
protected function setGlobalAddress($mailer, array $config, $type)
Expand Down
4 changes: 2 additions & 2 deletions src/HeloLaravelServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class HeloLaravelServiceProvider extends ServiceProvider
*/
public function boot()
{
if ($this->app->runningUnitTests() || ! $this->app['config']['helo.is_enabled']) {
if ($this->app->runningUnitTests() || !$this->app['config']['helo.is_enabled']) {
return;
}

Expand Down Expand Up @@ -73,7 +73,7 @@ protected function bootMailable()

private function version($app = null): int
{
if (! $app) {
if (!$app) {
$app = $this->app;
}

Expand Down
2 changes: 1 addition & 1 deletion src/MailManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class MailManager extends LaravelMailManager implements FactoryContract

public function mailer($name = null)
{
if (! $name) {
if (!$name) {
return $this->createLaravel9Mailer($this->app);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Mailer extends LaravelMailer implements MailerContract
public function send($view, array $data = [], $callback = null)
{
if ($view instanceof Mailable
&& ! $view instanceof ShouldQueue
&& !$view instanceof ShouldQueue
) {
$this->applyDebugHeaders($view);
}
Expand All @@ -33,7 +33,7 @@ protected function applyDebugHeaders(Mailable $mailable)

$viewFile = $this->getMailableViewFile($mailable);

if (! is_null($viewFile)) {
if (!is_null($viewFile)) {
$view = $this->getMailableView($viewFile);
$viewContent = $this->getMailableViewContent($view);
$viewData = $this->getMailableViewData($mailable);
Expand Down Expand Up @@ -62,7 +62,7 @@ protected function getMailableProperty($mailable, string $property)

protected function getMailableViewFile(Mailable $mailable)
{
if (! is_null($markdown = $this->getMailableProperty($mailable, 'markdown'))) {
if (!is_null($markdown = $this->getMailableProperty($mailable, 'markdown'))) {
return $markdown;
}

Expand All @@ -86,7 +86,7 @@ protected function getMailableViewData(Mailable $mailable)
$clonedData = $cloner->cloneVar($mailable->buildViewData());

return $dumper->dump($clonedData, true, [
'maxDepth' => 3,
'maxDepth' => 3,
'maxStringLength' => 160,
]);
}
Expand Down
3 changes: 1 addition & 2 deletions tests/HeloTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
Mail::assertSent(TestMail::class);
});

test('plain text mails work correctly', function ()
{
test('plain text mails work correctly', function () {
Mail::fake();

Mail::to('[email protected]')->send(new TestMail(true));
Expand Down

0 comments on commit a2f3571

Please sign in to comment.