Skip to content

Commit

Permalink
Revert "[10.x] Use MailManager as underlying passthru object for `M…
Browse files Browse the repository at this point in the history
…ailFake` (#46055)"

This reverts commit 2c51b48.
  • Loading branch information
driesvints committed Feb 24, 2023
1 parent d5d06fc commit 4e020bd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 67 deletions.
13 changes: 6 additions & 7 deletions src/Illuminate/Support/Testing/Fakes/MailFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Illuminate\Contracts\Mail\Mailer;
use Illuminate\Contracts\Mail\MailQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\MailManager;
use Illuminate\Support\Traits\ForwardsCalls;
use Illuminate\Support\Traits\ReflectsClosures;
use PHPUnit\Framework\Assert as PHPUnit;
Expand All @@ -20,9 +19,9 @@ class MailFake implements Factory, Mailer, MailQueue
/**
* The mailer instance.
*
* @var MailManager
* @var Mailer
*/
protected $manager;
protected $mailer;

/**
* The mailer currently being used to send a message.
Expand All @@ -48,12 +47,12 @@ class MailFake implements Factory, Mailer, MailQueue
/**
* Create a new mail fake.
*
* @param MailManager $manager
* @param Mailer $mailer
* @return void
*/
public function __construct(MailManager $manager)
public function __construct(Mailer $mailer)
{
$this->manager = $manager;
$this->mailer = $mailer;
}

/**
Expand Down Expand Up @@ -461,6 +460,6 @@ public function forgetMailers()
*/
public function __call($method, $parameters)
{
return $this->forwardCallTo($this->manager, $method, $parameters);
return $this->forwardCallTo($this->mailer, $method, $parameters);
}
}
55 changes: 0 additions & 55 deletions tests/Support/SupportMailTest.php

This file was deleted.

10 changes: 5 additions & 5 deletions tests/Support/SupportTestingMailFakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Contracts\Translation\HasLocalePreference;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\MailManager;
use Illuminate\Mail\Mailer;
use Illuminate\Support\Testing\Fakes\MailFake;
use Mockery as m;
use PHPUnit\Framework\ExpectationFailedException;
Expand All @@ -16,7 +16,7 @@ class SupportTestingMailFakeTest extends TestCase
/**
* @var \Mockery
*/
private $mailManager;
private $mailer;

/**
* @var \Illuminate\Support\Testing\Fakes\MailFake
Expand All @@ -31,8 +31,8 @@ class SupportTestingMailFakeTest extends TestCase
protected function setUp(): void
{
parent::setUp();
$this->mailManager = m::mock(MailManager::class);
$this->fake = new MailFake($this->mailManager);
$this->mailer = m::mock(Mailer::class);
$this->fake = new MailFake($this->mailer);
$this->mailable = new MailableStub;
}

Expand Down Expand Up @@ -224,7 +224,7 @@ public function testAssertSentWithClosure()

public function testMissingMethodsAreForwarded()
{
$this->mailManager->shouldReceive('foo')->andReturn('bar');
$this->mailer->shouldReceive('foo')->andReturn('bar');

$this->assertEquals('bar', $this->fake->foo());
}
Expand Down

0 comments on commit 4e020bd

Please sign in to comment.