delete test
This commit is contained in:
@@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class RoadPatrol extends Model
|
class RoadPatrol extends Model
|
||||||
{
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
public function observedItems()
|
public function observedItems()
|
||||||
|
|||||||
23
database/factories/RoadPatrolFactory.php
Normal file
23
database/factories/RoadPatrolFactory.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||||
|
*/
|
||||||
|
class RoadPatrolFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'operator_name' => $this->faker->name
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
35
tests/Feature/V2/Dashboard/RoadPatrolProject/DeleteTest.php
Normal file
35
tests/Feature/V2/Dashboard/RoadPatrolProject/DeleteTest.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature\V2\Dashboard\RoadPatrolProject;
|
||||||
|
|
||||||
|
use App\Models\City;
|
||||||
|
use App\Models\EdarateOstani;
|
||||||
|
use App\Models\EdarateShahri;
|
||||||
|
use App\Models\InfoItem;
|
||||||
|
use App\Models\Permission;
|
||||||
|
use App\Models\RoadPatrol;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Illuminate\Foundation\Testing\WithFaker;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class DeleteTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase, WithFaker;
|
||||||
|
/**
|
||||||
|
* A basic feature test example.
|
||||||
|
*/
|
||||||
|
public function test_type_is_required(): void
|
||||||
|
{
|
||||||
|
$user = User::factory()->create();
|
||||||
|
|
||||||
|
$roadPatrol = RoadPatrol::factory()->create();
|
||||||
|
|
||||||
|
$response = $this->actingAs($user)->postJson("v2/road_patrols/supervisor/cartable/delete/{$roadPatrol->id}");
|
||||||
|
|
||||||
|
$response->assertUnprocessable()
|
||||||
|
->assertInvalid([
|
||||||
|
'type' => __('validation.required', ['attribute' => 'type'])
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user