diff --git a/docker-compose.yml b/docker-compose.yml index 2af2539f2..91ba43819 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,22 +27,25 @@ services: mooc_mysql: container_name: codelytv-php_ddd_skeleton-mooc-mysql - image: mysql:8.0 + image: mysql/mysql-server:8.0.23 ports: - 3360:3306 environment: - MYSQL_ROOT_PASSWORD= - MYSQL_ALLOW_EMPTY_PASSWORD=yes + - MYSQL_ROOT_HOST=% healthcheck: test: ["CMD", "mysqladmin", "--user=root", "--password=", "--host=127.0.0.1", "ping", "--silent"] interval: 2s timeout: 10s retries: 10 - command: ["--default-authentication-plugin=mysql_native_password"] + command: ["--lower_case_table_names=1"] + + backoffice_elasticsearch: container_name: codelytv-php_ddd_skeleton-backoffice-elastic - image: docker.elastic.co/elasticsearch/elasticsearch:6.8.10 + image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0 ports: - 9200:9200 - 9300:9300 @@ -101,4 +104,4 @@ services: - shared_rabbitmq - shared_prometheus - mooc_mysql - command: symfony serve --dir=apps/mooc/backend/public --port=8030 --force-php-discovery + command: symfony serve --dir=apps/mooc/backend/public --port=8030 --force-php-discovery \ No newline at end of file diff --git a/tests/Mooc/Courses/Application/Create/CreateCourseCommandHandlerTest.php b/tests/Mooc/Courses/Application/Create/CreateCourseCommandHandlerTest.php index 6a85c1f1a..dcf5b35c8 100644 --- a/tests/Mooc/Courses/Application/Create/CreateCourseCommandHandlerTest.php +++ b/tests/Mooc/Courses/Application/Create/CreateCourseCommandHandlerTest.php @@ -34,4 +34,4 @@ public function it_should_create_a_valid_course(): void $this->dispatch($command, $this->handler); } -} +} \ No newline at end of file diff --git a/tests/Mooc/Courses/Application/Find/CourseFinderTest.php b/tests/Mooc/Courses/Application/Find/CourseFinderTest.php new file mode 100644 index 000000000..e6a500e56 --- /dev/null +++ b/tests/Mooc/Courses/Application/Find/CourseFinderTest.php @@ -0,0 +1,47 @@ +finder = new CourseFinder($this->repository()); + } + + /** @test */ + public function it_should_throw_an_exception_when_the_course_not_exist(): void + { + $this->expectException(CourseNotExist::class); + + $id = CourseIdMother::create(); + + $this->shouldSearch($id, null); + + $this->finder->__invoke($id); + } + + /** @test */ + public function it_should_find_an_existing_courses(): void + { + $course = CourseMother::create(); + + $this->shouldSearch($course->id(), $course); + + $courseFromRepository = $this->finder->__invoke($course->id()); + + $this->assertEquals($courseFromRepository, $course); + } +} \ No newline at end of file diff --git a/tests/Mooc/Courses/Application/Update/CourseRenamerTest.php b/tests/Mooc/Courses/Application/Update/CourseRenamerTest.php index 2815aa7fe..240cfc628 100644 --- a/tests/Mooc/Courses/Application/Update/CourseRenamerTest.php +++ b/tests/Mooc/Courses/Application/Update/CourseRenamerTest.php @@ -48,4 +48,4 @@ public function it_should_throw_an_exception_when_the_course_not_exist(): void $this->renamer->__invoke($id, CourseNameMother::create()); } -} +} \ No newline at end of file