Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ public function it_should_create_a_valid_course(): void

$this->dispatch($command, $this->handler);
}
}
}
47 changes: 47 additions & 0 deletions tests/Mooc/Courses/Application/Find/CourseFinderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

declare(strict_types=1);

namespace CodelyTv\Tests\Mooc\Courses\Application\Find;


use CodelyTv\Mooc\Courses\Application\Find\CourseFinder;
use CodelyTv\Mooc\Courses\Domain\CourseNotExist;
use CodelyTv\Tests\Mooc\Courses\CoursesModuleUnitTestCase;
use CodelyTv\Tests\Mooc\Courses\Domain\CourseIdMother;
use CodelyTv\Tests\Mooc\Courses\Domain\CourseMother;

class CourseFinderTest extends CoursesModuleUnitTestCase
{
private CourseFinder|null $finder;

protected function setUp(): void
{
parent::setUp();
$this->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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ public function it_should_throw_an_exception_when_the_course_not_exist(): void

$this->renamer->__invoke($id, CourseNameMother::create());
}
}
}