Skip to content

Instantly share code, notes, and snippets.

@tkaratug
Created April 24, 2022 11:41
Show Gist options
  • Save tkaratug/21a1282399d04fc15c3ec46e7fea3239 to your computer and use it in GitHub Desktop.
Save tkaratug/21a1282399d04fc15c3ec46e7fea3239 to your computer and use it in GitHub Desktop.
<?php
namespace Tests\Feature;
use Tests\TestCase;
use App\Models\Order;
class OrderControllerTest extends TestCase
{
public function it_returns_paid_and_delivered_orders_sorted_by_created_at_desc(): void
{
$orders = Order::factory()->count(20)->create();
$response = $this->get(route('orders.index'));
$response->assertOk();
$this->assertScopeCalled('paid', Order::class);
$this->assertScopeCalled('delivered', Order::class);
$this->assertScopeCalled('createdAtDesc', Order::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment