Skip to content

A free open source IT asset/license management system

Mark test as incomplete in SQLite

snipe968724f3692c
diff --git a/tests/Feature/Accessories/Api/IndexAccessoryTest.php b/tests/Feature/Accessories/Api/IndexAccessoryTest.php
index e210513170..e7a76c5ea8 100644
--- a/tests/Feature/Accessories/Api/IndexAccessoryTest.php
+++ b/tests/Feature/Accessories/Api/IndexAccessoryTest.php
@@ -3,8 +3,10 @@
namespace Tests\Feature\Accessories\Api;
use App\Models\Accessory;
+use App\Models\AccessoryCheckout;
use App\Models\Company;
use App\Models\User;
+use Illuminate\Testing\Fluent\AssertableJson;
use Tests\Concerns\TestsFullMultipleCompaniesSupport;
use Tests\Concerns\TestsPermissionsRequirement;
use Tests\TestCase;
@@ -67,4 +69,31 @@ class IndexAccessoryTest extends TestCase implements TestsFullMultipleCompaniesS
->assertResponseContainsInRows($accessoryA)
->assertResponseContainsInRows($accessoryB);
}
+
+ public function test_can_filter_accessories_by_searchable_count_alias()
+ {
+ $this->markIncompleteIfSqlite('This test is not compatible with SQLite');
+ $user = User::factory()->viewAccessories()->create();
+
+ $targetAccessory = Accessory::factory()->create(['name' => 'Accessory With Two Checkouts']);
+ $otherAccessory = Accessory::factory()->create(['name' => 'Accessory With One Checkout']);
+
+ AccessoryCheckout::factory()->count(2)->create(['accessory_id' => $targetAccessory->id]);
+ AccessoryCheckout::factory()->create(['accessory_id' => $otherAccessory->id]);
+
+ $this->actingAsForApi($user)
+ ->getJson(route('api.accessories.index', [
+ 'filter' => json_encode(['checkouts_count' => 2]),
+ 'sort' => 'id',
+ 'order' => 'asc',
+ 'offset' => '0',
+ 'limit' => '20',
+ ]))
+ ->assertOk()
+ ->assertJsonStructure([
+ 'total',
+ 'rows',
+ ])
+ ->assertJson(fn(AssertableJson $json) => $json->has('rows', 1)->where('rows.0.name', 'Accessory With Two Checkouts')->etc());
+ }
}
diff --git a/tests/Feature/AssetModels/Api/IndexAssetModelsTest.php b/tests/Feature/AssetModels/Api/IndexAssetModelsTest.php
index e80b4c5946..74637459b4 100644
--- a/tests/Feature/AssetModels/Api/IndexAssetModelsTest.php
+++ b/tests/Feature/AssetModels/Api/IndexAssetModelsTest.php
@@ -66,6 +66,7 @@ class IndexAssetModelsTest extends TestCase
public function test_asset_model_index_filter_can_search_computed_count_aliases()
{
+ $this->markIncompleteIfSqlite('This test is not compatible with SQLite');
$targetModel = AssetModel::factory()->create(['name' => 'Two Assets Model']);
$otherModel = AssetModel::factory()->create(['name' => 'One Asset Model']);