Revert "Inline some values"

This reverts commit 74b7d27408.
This commit is contained in:
Marcus Moore
2025-06-12 13:54:46 -07:00
parent 74b7d27408
commit 62b8e4c46f

View File

@@ -3,50 +3,37 @@
namespace Tests\Feature\Checkouts\General;
use App\Models\Asset;
use App\Models\Category;
use App\Models\Statuslabel;
use App\Models\User;
use Tests\TestCase;
class SettingAlertOnResponseTest extends TestCase
{
private Asset $asset;
private User $actor;
private User $assignedUser;
private Category $categoryThatAlerts;
private Category $categoryThatDoesNotAlert;
protected function setUp(): void
{
parent::setUp();
$this->asset = Asset::factory()->create();
$this->actor = User::factory()->checkoutAssets()->create();
$this->assignedUser = User::factory()->create();
$this->categoryThatAlerts = Category::factory()->create([
'require_acceptance' => true,
'alert_on_response' => true,
]);
$this->categoryThatDoesNotAlert = Category::factory()->create([
'require_acceptance' => true,
'alert_on_response' => false,
]);
}
public function test_sets_alert_on_response_if_enabled_by_category()
{
$asset = Asset::factory()->create();
$asset->model->update([
'category_id' => $this->categoryThatAlerts->id,
$this->asset->model->category->update([
'require_acceptance' => true,
'alert_on_response' => true,
]);
$this->postCheckout($asset);
$this->postCheckout($this->asset);
$this->assertDatabaseHas('checkout_acceptances', [
'checkoutable_type' => Asset::class,
'checkoutable_id' => $asset->id,
'checkoutable_id' => $this->asset->id,
'assigned_to_id' => $this->assignedUser->id,
'alert_on_response_id' => $this->actor->id,
]);
@@ -54,17 +41,16 @@ class SettingAlertOnResponseTest extends TestCase
public function test_does_not_set_alert_on_response_if_disabled_by_category()
{
$asset = Asset::factory()->create();
$asset->model->update([
'category_id' => $this->categoryThatDoesNotAlert->id,
$this->asset->model->category->update([
'require_acceptance' => true,
'alert_on_response' => false,
]);
$this->postCheckout($asset);
$this->postCheckout($this->asset);
$this->assertDatabaseHas('checkout_acceptances', [
'checkoutable_type' => Asset::class,
'checkoutable_id' => $asset->id,
'checkoutable_id' => $this->asset->id,
'assigned_to_id' => $this->assignedUser->id,
'alert_on_response_id' => null,
]);