Skip to content

Commit

Permalink
Keeps working on the test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Dec 12, 2023
1 parent f695dd9 commit efc4e55
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
2 changes: 2 additions & 0 deletions tests/Http/AuthorizationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Laravel\Telescope\TelescopeApplicationServiceProvider;
use Laravel\Telescope\Tests\FeatureTestCase;
use Orchestra\Testbench\Http\Middleware\VerifyCsrfToken;
use Illuminate\Foundation\Http\Middleware\ValidateCsrfToken;

class AuthorizationTest extends FeatureTestCase
{
Expand All @@ -25,6 +26,7 @@ protected function setUp(): void
parent::setUp();

$this->withoutMiddleware([VerifyCsrfToken::class]);
$this->withoutMiddleware([ValidateCsrfToken::class]);
}

protected function tearDown(): void
Expand Down
3 changes: 1 addition & 2 deletions tests/Http/AvatarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function it_can_register_custom_avatar_path()
$this->loadLaravelMigrations();

$user = UserEloquent::create([
'id' => 1,
'name' => 'Telescope',
'email' => 'telescope@laravel.com',
'password' => 'secret',
Expand All @@ -66,7 +65,7 @@ public function it_can_register_custom_avatar_path()
'entry' => [
'content' => [
'user' => [
'avatar' => '/images/1.jpg',
'avatar' => '/images/'.$user->id.'.jpg',
],
],
],
Expand Down
3 changes: 2 additions & 1 deletion tests/Http/RouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Laravel\Telescope\Http\Middleware\Authorize;
use Laravel\Telescope\Tests\FeatureTestCase;
use Orchestra\Testbench\Http\Middleware\VerifyCsrfToken;
use Illuminate\Foundation\Http\Middleware\ValidateCsrfToken;
use PHPUnit\Framework\Assert as PHPUnit;

class RouteTest extends FeatureTestCase
Expand All @@ -16,7 +17,7 @@ protected function setUp(): void
{
parent::setUp();

$this->withoutMiddleware([Authorize::class, VerifyCsrfToken::class]);
$this->withoutMiddleware([Authorize::class, VerifyCsrfToken::class, ValidateCsrfToken::class]);

$this->registerAssertJsonExactFragmentMacro();
}
Expand Down
20 changes: 11 additions & 9 deletions tests/Watchers/BatchWatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ public function test_job_dispatch_registers_entries()

private function createJobsTable(): void
{
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');
});
if (! Schema::hasTable('jobs')) {
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');
});
}

Schema::create('job_batches', function ($table) {
$table->string('id')->primary();
Expand Down
6 changes: 3 additions & 3 deletions tests/Watchers/ModelWatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function test_model_watcher_registers_entry()
$this->loadLaravelMigrations();
});

UserEloquent::query()
$user = UserEloquent::query()
->create([
'name' => 'Telescope',
'email' => 'telescope@laravel.com',
Expand All @@ -41,7 +41,7 @@ public function test_model_watcher_registers_entry()

$this->assertSame(EntryType::MODEL, $entry->type);
$this->assertSame('created', $entry->content['action']);
$this->assertSame(UserEloquent::class.':1', $entry->content['model']);
$this->assertSame(UserEloquent::class.':'.$user->id, $entry->content['model']);
}

public function test_model_watcher_can_restrict_events()
Expand All @@ -65,7 +65,7 @@ public function test_model_watcher_can_restrict_events()
$this->assertCount(1, $entries);
$this->assertSame(EntryType::MODEL, $entry->type);
$this->assertSame('created', $entry->content['action']);
$this->assertSame(UserEloquent::class.':1', $entry->content['model']);
$this->assertSame(UserEloquent::class.':'.$user->id, $entry->content['model']);
}

public function test_model_watcher_registers_hydration_entry()
Expand Down

0 comments on commit efc4e55

Please sign in to comment.