From 636c9d67cb97d119d3f747d0da66329e9dbf5bb7 Mon Sep 17 00:00:00 2001 From: Carles Blavi Date: Fri, 11 Mar 2022 18:40:17 +0100 Subject: [PATCH] [Added] Find Course unit test --- .../Application/Find/CourseFinderTest.php | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/Mooc/Courses/Application/Find/CourseFinderTest.php 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()); + } +}