Complete tests rewriting for main controllers

This commit is contained in:
Bubka
2021-11-15 00:21:07 +01:00
parent 627944a285
commit 22442f7af6
8 changed files with 854 additions and 1606 deletions

View File

@ -126,8 +126,8 @@ class GroupControllerTest extends FeatureTestCase
$response = $this->actingAs($this->user, 'api')
->json('PUT', '/api/v1/groups/' . $group->id, [
'name' => 'name updated',
])
'name' => 'name updated',
])
->assertOk()
->assertExactJson([
'id' => 1,
@ -144,8 +144,8 @@ class GroupControllerTest extends FeatureTestCase
{
$response = $this->actingAs($this->user, 'api')
->json('PUT', '/api/v1/groups/1000', [
'name' => 'testUpdate',
])
'name' => 'testUpdate',
])
->assertNotFound()
->assertJsonStructure([
'message'
@ -162,8 +162,8 @@ class GroupControllerTest extends FeatureTestCase
$response = $this->actingAs($this->user, 'api')
->json('PUT', '/api/v1/groups/' . $group->id, [
'name' => null,
])
'name' => null,
])
->assertStatus(422);
}
@ -178,8 +178,8 @@ class GroupControllerTest extends FeatureTestCase
$response = $this->actingAs($this->user, 'api')
->json('POST', '/api/v1/groups/' . $group->id . '/assign', [
'ids' => [1,2],
])
'ids' => [1,2],
])
->assertOk()
->assertExactJson([
'id' => $group->id,
@ -198,8 +198,8 @@ class GroupControllerTest extends FeatureTestCase
$response = $this->actingAs($this->user, 'api')
->json('POST', '/api/v1/groups/1000/assign', [
'ids' => [1,2],
])
'ids' => [1,2],
])
->assertNotFound()
->assertJsonStructure([
'message'
@ -217,8 +217,8 @@ class GroupControllerTest extends FeatureTestCase
$response = $this->actingAs($this->user, 'api')
->json('POST', '/api/v1/groups/' . $group->id . '/assign', [
'ids' => 1,
])
'ids' => 1,
])
->assertStatus(422);
}
@ -233,7 +233,7 @@ class GroupControllerTest extends FeatureTestCase
$assign = $this->actingAs($this->user, 'api')
->json('POST', '/api/v1/groups/' . $group->id . '/assign', [
'ids' => [1,2],
'ids' => [1,2],
]);
$response = $this->actingAs($this->user, 'api')
@ -266,7 +266,7 @@ class GroupControllerTest extends FeatureTestCase
$assign = $this->actingAs($this->user, 'api')
->json('POST', '/api/v1/groups/' . $group->id . '/assign', [
'ids' => [1,2],
'ids' => [1,2],
]);
$response = $this->actingAs($this->user, 'api')