-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathFindAllCoursesQueryHandlerTest.php
More file actions
41 lines (30 loc) · 1.21 KB
/
FindAllCoursesQueryHandlerTest.php
File metadata and controls
41 lines (30 loc) · 1.21 KB
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
<?php
declare(strict_types=1);
namespace CodelyTv\Tests\Mooc\Courses\Application\Find;
use CodelyTv\Mooc\Courses\Application\Find\AllCoursesFinder;
use CodelyTv\Mooc\Courses\Application\Find\FindAllCoursesQuery;
use CodelyTv\Mooc\Courses\Application\Find\FindAllCoursesQueryHandler;
use CodelyTv\Tests\Mooc\Courses\CoursesModuleUnitTestCase;
use CodelyTv\Tests\Mooc\Courses\Domain\CourseMother;
use CodelyTv\Tests\Mooc\Courses\Domain\CoursesResponseMother;
class FindAllCoursesQueryHandlerTest extends CoursesModuleUnitTestCase
{
private FindAllCoursesQueryHandler|null $handler;
protected function setUp(): void
{
parent::setUp();
$this->handler = new FindAllCoursesQueryHandler(new AllCoursesFinder($this->repository()));
}
/** @test */
public function it_should_find_all_existing_courses(): void
{
$courses = [
CourseMother::create(),
CourseMother::create()
];
$this->shouldFindAll($courses);
$coursesResponse = CoursesResponseMother::create($courses);
$courseFromRepository = $this->handler->__invoke(new FindAllCoursesQuery());
$this->assertEquals($courseFromRepository, $coursesResponse);
}
}