diff --git a/tests/Mooc/Courses/Application/Find/CourseFinderTest.php b/tests/Mooc/Courses/Application/Find/CourseFinderTest.php new file mode 100644 index 000000000..00b299f85 --- /dev/null +++ b/tests/Mooc/Courses/Application/Find/CourseFinderTest.php @@ -0,0 +1,43 @@ +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()); + } +}