mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-13 06:47:46 -08:00
Improve assertion
This commit is contained in:
parent
7d45cfff2c
commit
a2cba67f4e
|
@ -3,6 +3,7 @@
|
||||||
namespace Tests\Feature\Api\Accessories;
|
namespace Tests\Feature\Api\Accessories;
|
||||||
|
|
||||||
use App\Models\Accessory;
|
use App\Models\Accessory;
|
||||||
|
use App\Models\Actionlog;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Notifications\CheckoutAccessoryNotification;
|
use App\Notifications\CheckoutAccessoryNotification;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
|
@ -78,14 +79,18 @@ class AccessoryCheckoutTest extends TestCase
|
||||||
'note' => 'oh hi there',
|
'note' => 'oh hi there',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertDatabaseHas('action_logs', [
|
$this->assertEquals(
|
||||||
'action_type' => 'checkout',
|
1,
|
||||||
'target_id' => $user->id,
|
Actionlog::where([
|
||||||
'target_type' => User::class,
|
'action_type' => 'checkout',
|
||||||
'item_id' => $accessory->id,
|
'target_id' => $user->id,
|
||||||
'item_type' => Accessory::class,
|
'target_type' => User::class,
|
||||||
'user_id' => $actor->id,
|
'item_id' => $accessory->id,
|
||||||
'note' => 'oh hi there',
|
'item_type' => Accessory::class,
|
||||||
]);
|
'user_id' => $actor->id,
|
||||||
|
'note' => 'oh hi there',
|
||||||
|
])->count(),
|
||||||
|
'Log entry either does not exist or there are more than expected'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Tests\Feature\Checkouts;
|
namespace Tests\Feature\Checkouts;
|
||||||
|
|
||||||
use App\Models\Accessory;
|
use App\Models\Accessory;
|
||||||
|
use App\Models\Actionlog;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Notifications\CheckoutAccessoryNotification;
|
use App\Notifications\CheckoutAccessoryNotification;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
|
@ -78,14 +79,18 @@ class AccessoryCheckoutTest extends TestCase
|
||||||
'note' => 'oh hi there',
|
'note' => 'oh hi there',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertDatabaseHas('action_logs', [
|
$this->assertEquals(
|
||||||
'action_type' => 'checkout',
|
1,
|
||||||
'target_id' => $user->id,
|
Actionlog::where([
|
||||||
'target_type' => User::class,
|
'action_type' => 'checkout',
|
||||||
'item_id' => $accessory->id,
|
'target_id' => $user->id,
|
||||||
'item_type' => Accessory::class,
|
'target_type' => User::class,
|
||||||
'user_id' => $actor->id,
|
'item_id' => $accessory->id,
|
||||||
'note' => 'oh hi there',
|
'item_type' => Accessory::class,
|
||||||
]);
|
'user_id' => $actor->id,
|
||||||
|
'note' => 'oh hi there',
|
||||||
|
])->count(),
|
||||||
|
'Log entry either does not exist or there are more than expected'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue