Skip to content

Commit 5d94119

Browse files
dleicamJosé Postiga
authored andcommitted
Resolved - A guest or an authenticated user can list questions (laravel-portugal#26) - minor cleanup and code style fixes
1 parent d9be4ce commit 5d94119

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

domains/Discussions/Controllers/QuestionsGetController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __invoke(Request $request): AnonymousResourceCollection
3131
'created' => 'sometimes|array|size:2',
3232
'created.from' => 'required_with:created|date',
3333
'created.to' => 'required_with:created|date|afterOrEqual:created.from',
34-
'resolved' => 'sometimes|boolean'
34+
'resolved' => 'sometimes|boolean',
3535
]);
3636

3737
$question = $this->question

domains/Discussions/Tests/Feature/QuestionsGetTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function it_possible_to_see_a_question(): void
4343
]
4444
]);
4545

46-
$this->assertEquals(15, count($response->decodedJsonResponse()['data']));
46+
self::assertEquals(15, count($response->decodedJsonResponse()['data']));
4747
}
4848

4949
/** @test */
@@ -88,8 +88,8 @@ public function it_supports_pagination_navigation(): void
8888
{
8989
$response = $this->get(route('discussions.questions.index', ['page' => 2]));
9090
$response->assertResponseOk();
91-
$this->assertEquals(2, $response->decodedJsonResponse()['meta']['current_page']);
92-
$this->assertEquals(2, $response->decodedJsonResponse()['meta']['current_page']);
91+
92+
self::assertEquals(2, $response->decodedJsonResponse()['meta']['current_page']);
9393
}
9494

9595
/** @test */
@@ -100,7 +100,7 @@ public function it_searchable_by_author(): void
100100

101101
$response = $this->get(route('discussions.questions.index', ['author' => $user->id]));
102102

103-
$this->assertEquals(1, count($response->decodedJsonResponse()['data']));
103+
self::assertEquals(1, count($response->decodedJsonResponse()['data']));
104104
}
105105

106106
/** @test */
@@ -111,7 +111,7 @@ public function it_searchable_by_title(): void
111111

112112
$response = $this->get(route('discussions.questions.index', ['title' => 'LArAvEL-pt']));
113113

114-
$this->assertEquals(2, count($response->decodedJsonResponse()['data']));
114+
self::assertEquals(2, count($response->decodedJsonResponse()['data']));
115115
}
116116

117117
/** @test */
@@ -124,13 +124,13 @@ public function it_searchable_by_created_at(): void
124124
'created[from]' => Carbon::now()->subMonth()->subYears(2)->toDateString(),
125125
'created[to]' => Carbon::now()->addMonth()->subYears(2)->toDateString()
126126
]));
127-
$this->assertEquals(1, count($response->decodedJsonResponse()['data']));
127+
self::assertEquals(1, count($response->decodedJsonResponse()['data']));
128128

129129
$response = $this->get(route('discussions.questions.index', [
130130
'created[from]' => Carbon::now()->subMonth()->subYears(3)->toDateString(),
131131
'created[to]' => Carbon::now()->addMonth()->subYears(2)->toDateString()
132132
]));
133-
$this->assertEquals(2, count($response->decodedJsonResponse()['data']));
133+
self::assertEquals(2, count($response->decodedJsonResponse()['data']));
134134
}
135135

136136
/** @test */
@@ -139,7 +139,8 @@ public function it_searchable_by_resolved(): void
139139
QuestionFactory::new(['resolved_at' => Carbon::now()->toDateString()])->create();
140140

141141
$response = $this->get(route('discussions.questions.index', ['resolved' => true]));
142-
$this->assertEquals(1, count($response->decodedJsonResponse()['data']));
142+
143+
self::assertEquals(1, count($response->decodedJsonResponse()['data']));
143144
}
144145

145146
/** @test */

0 commit comments

Comments
 (0)