-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathCourseFinderTest.php
More file actions
43 lines (32 loc) · 1.15 KB
/
CourseFinderTest.php
File metadata and controls
43 lines (32 loc) · 1.15 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
42
43
<?php
declare(strict_types=1);
namespace CodelyTv\Tests\Mooc\Courses\Application\Find;
use CodelyTv\Mooc\Courses\Domain\CourseNotExist;
use CodelyTv\Tests\Mooc\Courses\Domain\CourseMother;
use CodelyTv\Mooc\Courses\Application\Find\CourseFinder;
use CodelyTv\Tests\Mooc\Courses\CoursesModuleUnitTestCase;
final class CourseFinderTest extends CoursesModuleUnitTestCase
{
private CourseFinder $finder;
protected function setUp(): void
{
parent::setUp();
$this->finder = new CourseFinder($this->repository());
}
/** @test */
public function it_should_find_a_course(): void
{
$course = CourseMother::create();
$this->shouldSearch($course->id(), $course);
$courseFound = $this->finder->__invoke($course->id());
$this->assertSimilar($courseFound->id(), $course->id());
}
/** @test */
public function it_should_return_an_exception_finding_an_inexsitent_course(): void
{
$course = CourseMother::create();
$this->shouldSearch($course->id(), null);
$this->expectException(CourseNotExist::class);
$this->finder->__invoke($course->id());
}
}