test works, helper still needs work. pushing to check something

This commit is contained in:
spencerrlongg 2024-07-23 16:46:29 -05:00
parent 00ebc8b64d
commit 0f2f559d7a
2 changed files with 29 additions and 0 deletions

View file

@ -914,11 +914,21 @@ 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 {
return true;
}
}
}
}
}

View 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);
}
}