Skip to content

Commit

Permalink
Add regression test for resuming recording with sync jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
erikgaal committed Sep 4, 2019
1 parent d9c5c53 commit fedd672
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/Telescope/TelescopeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Laravel\Telescope\Tests\Telescope;

use Laravel\Telescope\Telescope;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Contracts\Queue\ShouldQueue;
use Laravel\Telescope\Tests\FeatureTestCase;
use Laravel\Telescope\Watchers\QueryWatcher;
use Laravel\Telescope\Contracts\EntriesRepository;
Expand Down Expand Up @@ -70,4 +72,37 @@ public function after_recording_callback_can_store_and_flush()

$this->assertCount(1, Telescope::$entriesQueue);
}

/**
* @test
*/
public function dont_start_recording_when_dispatching_job_synchronously()
{
Telescope::stopRecording();

$this->assertFalse(Telescope::isRecording());

$this->app->get(Dispatcher::class)->dispatch(
new MySyncJob('Awesome Laravel')
);

$this->assertFalse(Telescope::isRecording());
}
}

class MySyncJob implements ShouldQueue
{
public $connection = 'sync';

private $payload;

public function __construct($payload)
{
$this->payload = $payload;
}

public function handle()
{
//
}
}

0 comments on commit fedd672

Please sign in to comment.