-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Closed
Description
- Laravel Version: 5.5.32
- PHP Version: Irrelevant
- Database Driver & Version: Irrelevant
Description:
| $handler = $this->dispatcher->getCommandHandler($command) ?: null; |
In this file, $this->dispatcher is an instance of Illuminate\Contracts\Bus\Dispatcher.
Illuminate\Contracts\Bus\Dispatcher has no method getCommandHandler defined so when mockery create a mock of the dispatcher, the function getCommandHandler is not available.
You get this error:
BadMethodCallException : Method Mockery_0_Illuminate_Contracts_Bus_Dispatcher::getCommandHandler() does not exist on this mock object
/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:70
/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:49
/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:76
/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php:42
/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Queue.php:44
/var/www/html/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:475
/var/www/html/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:434
/var/www/html/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:369
/var/www/html/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:200
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:465
// ...
Steps To Reproduce:
This test generates the error.
<?php
class BuggyListener implements \Illuminate\Contracts\Broadcasting\ShouldBroadcast
{
public function broadcastOn()
{
return [];
}
}
class LaravelBugTest extends Illuminate\Foundation\Testing\TestCase
{
public function testBug()
{
$this->expectsJobs([]);
event(new BuggyListener());
}
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
return $app;
}
}
Metadata
Metadata
Assignees
Labels
No labels