-
Notifications
You must be signed in to change notification settings - Fork 0
/
GroupSettingsTest.php
58 lines (52 loc) · 1.95 KB
/
GroupSettingsTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
namespace Tests\Feature;
use Tests\TestCase;
use App\Project\Models\Project;
class GroupSettingsTest extends TestCase
{
/** @test */
public function user_can_get_group_settings()
{
$project = factory(Project::class)->create(['owner_id' => $this->user->id]);
$this->actingAs($this->user)
->call('GET', 'groups/settings', [
'group_type' => 'project',
'group_id' => $project->id,
])
->assertJsonFragment([
'status' => 'success',
'task_enabled' => '1',
'discussion_enabled' => '1',
'message_enabled' => '1',
'event_enabled' => '1',
'file_enabled' => '1',
]);
}
/** @test */
public function admin_can_enable_and_disable_tools()
{
$project = factory(Project::class)->create(['owner_id' => $this->user->id]);
$this->actingAs($this->user);
$project->members()->save($this->user);
$this->call('PUT', 'groups/settings', [
'group_type' => 'project',
'group_id' => $project->id,
'task_enabled' => 0,
])
->assertJsonFragment([
'status' => 'success',
'message' => 'Settings have been updated',
]);
$this->assertDatabaseHas('project_settings', ['project_id' => $project->id, 'task_enabled' => 0]);
$this->call('PUT', 'groups/settings', [
'group_type' => 'project',
'group_id' => $project->id,
'task_enabled' => 1,
])
->assertJsonFragment([
'status' => 'success',
'message' => 'Settings have been updated',
]);
$this->assertDatabaseHas('project_settings', ['project_id' => $project->id, 'task_enabled' => 1]);
}
}