-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStatusTest.php
116 lines (99 loc) · 4.03 KB
/
StatusTest.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
namespace Tests\Unit;
use App\Models\Category;
use App\Models\Idea;
use App\Models\Status;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class StatusTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function can_get_count_of_each_status()
{
$user = User::factory()->create();
$categoryOne = Category::factory()->create(['name' => 'Categorie 1']);
$statusOpen = Status::factory()->create(['name' => 'Ouvert']);
$statusConsidering = Status::factory()->create(['name' => 'En attente']);
$statusInProgress = Status::factory()->create(['name' => 'En cours']);
$statusImplemented = Status::factory()->create(['name' => 'Validé']);
$statusClosed = Status::factory()->create(['name' => 'Clos']);
Idea::factory()->create([
'user_id' => $user->id,
'title' => 'Ma première idée',
'category_id' => $categoryOne->id,
'status_id' => $statusOpen->id,
'description' => 'Description de ma première idée',
]);
Idea::factory()->create([
'user_id' => $user->id,
'title' => 'Ma deuxieme idée',
'category_id' => $categoryOne->id,
'status_id' => $statusOpen->id,
'description' => 'Description de ma première idée',
]);
Idea::factory()->create([
'user_id' => $user->id,
'title' => 'Ma troisième idée',
'category_id' => $categoryOne->id,
'status_id' => $statusConsidering->id,
'description' => 'Description de ma première idée',
]);
Idea::factory()->create([
'user_id' => $user->id,
'title' => 'Ma quatrième idée',
'category_id' => $categoryOne->id,
'status_id' => $statusConsidering->id,
'description' => 'Description de ma première idée',
]);
Idea::factory()->create([
'user_id' => $user->id,
'title' => 'Ma cinquième idée',
'category_id' => $categoryOne->id,
'status_id' => $statusInProgress->id,
'description' => 'Description de ma première idée',
]);
Idea::factory()->create([
'user_id' => $user->id,
'title' => 'Ma sixième idée',
'category_id' => $categoryOne->id,
'status_id' => $statusInProgress->id,
'description' => 'Description de ma première idée',
]);
Idea::factory()->create([
'user_id' => $user->id,
'title' => 'Ma septième idée',
'category_id' => $categoryOne->id,
'status_id' => $statusImplemented->id,
'description' => 'Description de ma première idée',
]);
Idea::factory()->create([
'user_id' => $user->id,
'title' => 'Ma huitième idée',
'category_id' => $categoryOne->id,
'status_id' => $statusImplemented->id,
'description' => 'Description de ma première idée',
]);
Idea::factory()->create([
'user_id' => $user->id,
'title' => 'Ma neuvieme idée',
'category_id' => $categoryOne->id,
'status_id' => $statusClosed->id,
'description' => 'Description de ma première idée',
]);
Idea::factory()->create([
'user_id' => $user->id,
'title' => 'Ma dixième idée',
'category_id' => $categoryOne->id,
'status_id' => $statusClosed->id,
'description' => 'Description de ma première idée',
]);
$this->assertEquals(10, Status::getCount()['all_statuses']);
$this->assertEquals(2, Status::getCount()['open']);
$this->assertEquals(2, Status::getCount()['considering']);
$this->assertEquals(2, Status::getCount()['in_progress']);
$this->assertEquals(2, Status::getCount()['implemented']);
$this->assertEquals(2, Status::getCount()['closed']);
}
}