Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.8] Fixed circular dependency - fix #28165 #28164

Merged
merged 3 commits into from
Apr 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Illuminate/Support/Testing/Fakes/QueueFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Support\Testing\Fakes;

use BadMethodCallException;
use Illuminate\Queue\QueueManager;
use Illuminate\Contracts\Queue\Queue;
use PHPUnit\Framework\Assert as PHPUnit;
Expand Down Expand Up @@ -357,4 +358,18 @@ public function setConnectionName($name)
{
return $this;
}

/**
* Override the QueueManager to prevent circular dependency.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
throw new BadMethodCallException(sprintf(
'Call to undefined method %s::%s()', static::class, $method
));
}
}
12 changes: 12 additions & 0 deletions tests/Support/SupportTestingQueueFakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Tests\Support;

use BadMethodCallException;
use Illuminate\Bus\Queueable;
use PHPUnit\Framework\TestCase;
use Illuminate\Foundation\Application;
Expand Down Expand Up @@ -227,6 +228,17 @@ public function testAssertPushedWithChainErrorHandling()
$this->assertThat($e, new ExceptionMessage('The expected chain was not pushed'));
}
}

public function testCallUndefinedMethodErrorHandling()
{
try {
$this->fake->undefinedMethod();
} catch (BadMethodCallException $e) {
$this->assertThat($e, new ExceptionMessage(sprintf(
'Call to undefined method %s::%s()', get_class($this->fake), 'undefinedMethod'
)));
}
}
}

class JobStub
Expand Down