Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Barryvdh\Debugbar\Tests\DataCollector; use Barryvdh\Debugbar\Tests\Jobs\..
Decoded Output download
<?php
namespace Barryvdh\Debugbar\Tests\DataCollector;
use Barryvdh\Debugbar\Tests\Jobs\OrderShipped;
use Barryvdh\Debugbar\Tests\Jobs\SendNotification;
use Barryvdh\Debugbar\Tests\TestCase;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Schema;
class JobsCollectorTest extends TestCase
{
use RefreshDatabase;
protected function getEnvironmentSetUp($app)
{
$app['config']->set('debugbar.collectors.jobs', true);
// The `sync` and `null` driver don't dispatch events
// `database` or `redis` driver work great
$app['config']->set('queue.default', 'database');
parent::getEnvironmentSetUp($app);
}
public function testItCollectsDispatchedJobs()
{
$this->loadLaravelMigrations();
$this->createJobsTable();
debugbar()->boot();
/** @var \DebugBar\DataCollector\ObjectCountCollector $collector */
$collector = debugbar()->getCollector('jobs');
$collector->setXdebugLinkTemplate('');
$this->assertEquals(
['data' => [], 'count' => 0, 'is_counter' => true],
$collector->collect()
);
OrderShipped::dispatch(1);
$this->assertEquals(
['data' => [OrderShipped::class => 1], 'count' => 1, 'is_counter' => true],
$collector->collect()
);
dispatch(new SendNotification());
dispatch(new SendNotification());
dispatch(new SendNotification());
$this->assertEquals(
['data' => [OrderShipped::class => 1, SendNotification::class => 3], 'count' => 4, 'is_counter' => true],
$collector->collect()
);
}
protected function createJobsTable()
{
(new class extends Migration
{
public function up()
{
if (Schema::hasTable('jobs')) {
return;
}
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
})->up();
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Barryvdh\Debugbar\Tests\DataCollector;
use Barryvdh\Debugbar\Tests\Jobs\OrderShipped;
use Barryvdh\Debugbar\Tests\Jobs\SendNotification;
use Barryvdh\Debugbar\Tests\TestCase;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Schema;
class JobsCollectorTest extends TestCase
{
use RefreshDatabase;
protected function getEnvironmentSetUp($app)
{
$app['config']->set('debugbar.collectors.jobs', true);
// The `sync` and `null` driver don't dispatch events
// `database` or `redis` driver work great
$app['config']->set('queue.default', 'database');
parent::getEnvironmentSetUp($app);
}
public function testItCollectsDispatchedJobs()
{
$this->loadLaravelMigrations();
$this->createJobsTable();
debugbar()->boot();
/** @var \DebugBar\DataCollector\ObjectCountCollector $collector */
$collector = debugbar()->getCollector('jobs');
$collector->setXdebugLinkTemplate('');
$this->assertEquals(
['data' => [], 'count' => 0, 'is_counter' => true],
$collector->collect()
);
OrderShipped::dispatch(1);
$this->assertEquals(
['data' => [OrderShipped::class => 1], 'count' => 1, 'is_counter' => true],
$collector->collect()
);
dispatch(new SendNotification());
dispatch(new SendNotification());
dispatch(new SendNotification());
$this->assertEquals(
['data' => [OrderShipped::class => 1, SendNotification::class => 3], 'count' => 4, 'is_counter' => true],
$collector->collect()
);
}
protected function createJobsTable()
{
(new class extends Migration
{
public function up()
{
if (Schema::hasTable('jobs')) {
return;
}
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
})->up();
}
}
Function Calls
None |
Stats
MD5 | d41277f376e11748f071407ae2b54bb6 |
Eval Count | 0 |
Decode Time | 107 ms |