snipe-it/tests/Unit/AssetModelTest.php

29 lines
691 B
PHP
Raw Normal View History

2016-03-25 01:18:05 -07:00
<?php
namespace Tests\Unit;
use App\Models\Asset;
use App\Models\Category;
2016-03-25 01:18:05 -07:00
use App\Models\AssetModel;
use Tests\Support\InteractsWithSettings;
2023-03-07 16:57:55 -08:00
use Tests\TestCase;
2016-03-25 01:18:05 -07:00
2023-03-07 16:57:55 -08:00
class AssetModelTest extends TestCase
2016-03-25 01:18:05 -07:00
{
use InteractsWithSettings;
public function testAnAssetModelContainsAssets()
{
$category = Category::factory()->create([
'category_type' => 'asset'
]);
$model = AssetModel::factory()->create([
'category_id' => $category->id,
]);
$asset = Asset::factory()->create([
'model_id' => $model->id
]);
$this->assertEquals(1, $model->assets()->count());
}
2016-03-25 01:18:05 -07:00
}