Added base asset models test
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
f3e82c2c80
commit
233e4af7f8
2 changed files with 39 additions and 1 deletions
|
@ -85,7 +85,7 @@ class AssetModelsController extends Controller
|
||||||
$model->category_id = $request->input('category_id');
|
$model->category_id = $request->input('category_id');
|
||||||
$model->notes = $request->input('notes');
|
$model->notes = $request->input('notes');
|
||||||
$model->user_id = Auth::id();
|
$model->user_id = Auth::id();
|
||||||
$model->requestable = Request::has('requestable');
|
$model->requestable = $request->has('requestable');
|
||||||
|
|
||||||
if ($request->input('fieldset_id') != '') {
|
if ($request->input('fieldset_id') != '') {
|
||||||
$model->fieldset_id = $request->input('fieldset_id');
|
$model->fieldset_id = $request->input('fieldset_id');
|
||||||
|
|
38
tests/Feature/AssetModels/Ui/AssetModelsTest.php
Normal file
38
tests/Feature/AssetModels/Ui/AssetModelsTest.php
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature\AssetModels\Ui;
|
||||||
|
|
||||||
|
use App\Models\Category;
|
||||||
|
use App\Models\AssetModel;
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\CustomField;
|
||||||
|
use App\Models\Statuslabel;
|
||||||
|
use App\Models\Supplier;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Facades\Crypt;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class AssetModelsTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testUserCanListAssetModels()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->get(route('models.index'))
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUserCanCreateAssetModels()
|
||||||
|
{
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('models.index'), [
|
||||||
|
'name' => 'Test Model',
|
||||||
|
'category_id' => Category::factory()->create()->id
|
||||||
|
])
|
||||||
|
->assertStatus(302)
|
||||||
|
->assertRedirect(route('models.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue