add permission to the db

This commit is contained in:
2024-04-07 14:09:36 +03:30
parent 99b21c16f4
commit 08445ae219
2 changed files with 23 additions and 9 deletions

View File

@@ -19,7 +19,17 @@ class GetAllDataToMapTest extends TestCase
{
$user = User::factory()->create();
RoadPatrol::factory(7)
RoadPatrol::factory()
->sequence(
['id' => 1],
['id' => 2],
['id' => 3],
['id' => 4],
['id' => 5],
['id' => 6],
['id' => 7],
)
->count(7)
->create();
$response = $this->actingAs($user)->getJson('/v2/road_patrols/report/map');

View File

@@ -27,6 +27,10 @@ class StoreTest extends TestCase
*/
public function test_user_should_have_add_road_patrol_permission(): void
{
$permission = Permission::factory()->create([
'name' => 'add-road-patrol'
]);
$user = User::factory()->create();
$response = $this->actingAs($user)->postJson('v2/road_patrols/operator/store');
@@ -651,8 +655,8 @@ class StoreTest extends TestCase
'observed_items' => [
[
'after_image' => UploadedFile::fake()->create('image.jpg', 10),
'item_id' => $this->faker->randomNumber(),
'sub_item_id' => $this->faker->randomNumber(),
'item_id' => 1,
'sub_item_id' => 1,
'local_name' => $this->faker->name(),
'instant_action' => 0,
'start_point' => '12,12',
@@ -663,8 +667,8 @@ class StoreTest extends TestCase
];
$infoItem = InfoItem::factory()->create([
'item' => $attributes['observed_items'][0]['item_id'],
'sub_item' => $attributes['observed_items'][0]['sub_item_id'],
'item' => 1,
'sub_item' => 1,
]);
$mock = $this->mock(NominatimService::class, function (MockInterface $mock) {
@@ -977,8 +981,8 @@ class StoreTest extends TestCase
'end_time' => '2017-01-23 11:53',
'observed_items' => [
[
'item_id' => $this->faker->randomNumber(),
'sub_item_id' => $this->faker->randomNumber(),
'item_id' => 1,
'sub_item_id' => 1,
'local_name' => $this->faker->name(),
'instant_action' => 1,
'start_point' => '12,12',
@@ -990,8 +994,8 @@ class StoreTest extends TestCase
];
$infoItem = InfoItem::factory()->create([
'item' => $attributes['observed_items'][0]['item_id'],
'sub_item' => $attributes['observed_items'][0]['sub_item_id'],
'item' => 1,
'sub_item' => 1,
]);
$mock = $this->mock(NominatimService::class, function (MockInterface $mock) {