mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
test works, helper still needs work. pushing to check something
This commit is contained in:
parent
00ebc8b64d
commit
0f2f559d7a
|
@ -914,6 +914,15 @@ class Helper
|
|||
$rules = $class::rules();
|
||||
foreach ($rules as $rule_name => $rule) {
|
||||
if ($rule_name == $field) {
|
||||
if (is_array($rule)) {
|
||||
foreach ($rule as $rule_value) {
|
||||
if ($rule_value === 'required') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (strpos($rule, 'required') === false) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -922,6 +931,7 @@ class Helper
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if the given key exists in the array, and trim excess white space before returning it
|
||||
|
|
19
tests/Feature/Assets/Ui/EditAssetTest.php
Normal file
19
tests/Feature/Assets/Ui/EditAssetTest.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Feature\Assets\Ui;
|
||||
|
||||
use App\Models\Asset;
|
||||
use App\Models\User;
|
||||
use Tests\TestCase;
|
||||
|
||||
class EditAssetTest extends TestCase
|
||||
{
|
||||
public function testPageCanBeAccessed(): void
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
$user = User::factory()->editAssets()->create();
|
||||
$response = $this->actingAs($user)->get(route('hardware.edit', $asset->id));
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue