Skip to content

Commit

Permalink
Update te readme to reflect the new contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezcasas committed Feb 15, 2019
1 parent 0f40fc5 commit cafd1b2
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ applications/*/var/logs/*
src/Shared/Infrastructure/Symfony/Bundle/DependencyInjection/Resources/infrastructure_parameters.yml
src/Context/*/Infrastructure/Symfony/Bundle/DependencyInjection/Resources/*_parameters.yml

/applications/api/config/supervisor/*
!/applications/api/config/supervisor/.gitkeep
/applications/mooc_backend/config/supervisor/*
!/applications/mooc_backend/config/supervisor/.gitkeep

/phpunit.xml

Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ and some [Consumers](applications/api/src/Command).

### Bounded Contexts
Currently the project has two main bounded contexts:
* [Course](src/Context/Course): WIP
* [Video](src/Context/Course): If you wanna see some code, look inside this context :)
* [Backoffice](src/Context/Backoffice): WIP
* [Mooc](src/Context/Mooc): If you wanna see some code, look inside this context :)

### Hexagonal Architecture
This repository follow the Hexagonal Architecture pattern. Also is structured using `modules`.
With this, we can see that the current structure of a Bounded Context is:
```bash
Video # <-- Bounded Context name
Mooc # <-- Bounded Context name
|-- Infrastructure # <-- All Bounded Context common infrastructure
| |-- Doctrine
| `-- Symfony
Expand Down Expand Up @@ -148,23 +148,23 @@ Our repositories try to be as simple as possible usually only containing 2 metho
If we need some query with more filters we use the `Strategy` pattern also known as `Criteria` pattern. So we add a
`searchByCriteria` method.

You can see an example [here](src/Context/Video/Module/Video/Domain/VideoRepository.php)
and its implementation [here](src/Context/Video/Module/Video/Infrastructure/Persistence/VideoRepositoryMySql.php).
You can see an example [here](src/Context/Mooc/Module/Video/Domain/VideoRepository.php)
and its implementation [here](src/Context/Mooc/Module/Video/Infrastructure/Persistence/VideoRepositoryMySql.php).

### Aggregates
You can see an example of an aggregate [here](src/Context/Video/Module/Video/Domain/Video.php). All aggregates should
You can see an example of an aggregate [here](src/Context/Mooc/Module/Video/Domain/Video.php). All aggregates should
extends the [AggregateRoot](src/Shared/Domain/Aggregate/AggregateRoot.php).

### Command Bus
There are 2 implementations of the [command bus](src/Shared/Domain/Bus/Command/CommandBus.php).
1. [Sync](src/Infrastructure/Bus/Command/SymfonySyncCommandBus.php) using the Symfony Message Bus
2. [Async](src/Infrastructure/Bus/Command/CommandBusAsync.php) using a local file
1. [Sync](src/Shared/Infrastructure/Bus/Command/SymfonySyncCommandBus.php) using the Symfony Message Bus
2. [Async](src/Shared/Infrastructure/Bus/Command/CommandBusAsync.php) using a local file

### Query Bus
The [Query Bus](src/Infrastructure/Bus/Query/SymfonySyncQueryBus.php) uses the Symfony Message Bus.
The [Query Bus](src/Shared/Infrastructure/Bus/Query/SymfonySyncQueryBus.php) uses the Symfony Message Bus.

### Event Bus
The [Event Bus](src/Infrastructure/Bus/Event/SymfonySyncEventBus.php) uses the Symfony Message Bus.
The [Event Bus](src/Shared/Infrastructure/Bus/Event/SymfonySyncEventBus.php) uses the Symfony Message Bus.


<!-- CONTRIBUTING -->
Expand Down
4 changes: 2 additions & 2 deletions applications/mooc_backend/bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set_time_limit(0);

require_once __DIR__ . '/../../bootstrap.php';

use CodelyTv\MoocBackend\ApiKernel;
use CodelyTv\MoocBackend\MoocBackendKernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
Expand All @@ -18,6 +18,6 @@ if ($debug) {
Debug::enable();
}

$kernel = new ApiKernel($env, $debug);
$kernel = new MoocBackendKernel($env, $debug);
$application = new Application($kernel);
$application->run($input);
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;

final class ApiKernel extends Kernel
final class MoocBackendKernel extends Kernel
{
public function registerBundles()
{
Expand Down
4 changes: 2 additions & 2 deletions applications/mooc_backend/web/api.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

use CodelyTv\MoocBackend\ApiKernel;
use CodelyTv\MoocBackend\MoocBackendKernel;
use CodelyTv\Shared\Infrastructure\Symfony\KernelCache;
use Symfony\Component\HttpFoundation\Request;

require_once __DIR__ . '/../../bootstrap.php';

$env = 'prod';
$debug = false;
$kernel = new KernelCache(new ApiKernel($env, $debug));
$kernel = new KernelCache(new MoocBackendKernel($env, $debug));

$request = Request::createFromGlobals();
Request::setTrustedProxies([$request->server->get('REMOTE_ADDR')], Request::HEADER_X_FORWARDED_ALL);
Expand Down
4 changes: 2 additions & 2 deletions applications/mooc_backend/web/api_dev.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use CodelyTv\MoocBackend\ApiKernel;
use CodelyTv\MoocBackend\MoocBackendKernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;

Expand All @@ -26,7 +26,7 @@

$env = 'dev';
$debug = true;
$kernel = new ApiKernel($env, $debug);
$kernel = new MoocBackendKernel($env, $debug);

$request = Request::createFromGlobals();
$response = $kernel->handle($request);
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test:
- composer install --optimize-autoloader --prefer-dist
- applications/mooc_backend/bin/console cache:warmup --env=prod
override:
- ./vendor/bin/phpstan analyse -l 7 -c etc/phpstan/phpstan.neon applications/api/src applications/codely/src
- ./vendor/bin/phpstan analyse -l 7 -c etc/phpstan/phpstan.neon applications/mooc_backend/src applications/codely/src
- ./vendor/bin/phpunit --exclude-group='disabled'
- ./vendor/bin/behat -p applications --format=progress -v
- ./vendor/bin/behat -p mooc_backend --format=progress -v
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Feature: Bootstrap check
When I run the "<app>" console
Then the console command should run successfully
Examples:
| app |
| codely |
| api |
| app |
| codely |
| mooc_backend |
10 changes: 5 additions & 5 deletions tests/EntryPoint/mooc_backend/mooc_backend.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
api:
mooc_backend:
extensions:
Behat\Symfony2Extension:
kernel:
class: CodelyTv\Api\ApiKernel
class: CodelyTv\MoocBackend\MoocBackendKernel
Behat\MinkExtension:
sessions:
my_session:
Expand All @@ -14,7 +14,7 @@ api:
status:
paths: [ tests/EntryPoint/mooc_backend/features/status ]
contexts:
- CodelyTv\Test\Infrastructure\Behat\ApiFeatureContext:
- CodelyTv\Test\Shared\Infrastructure\Behat\ApiFeatureContext:
connections: '@codely.infrastructure.database_connections'
publisher: '@codely.mooc.domain_event_publisher'
bus: '@codely.mooc.event_bus'
Expand All @@ -23,7 +23,7 @@ api:
video:
paths: [ tests/EntryPoint/mooc_backend/features/video ]
contexts:
- CodelyTv\Test\Infrastructure\Behat\ApiFeatureContext:
- CodelyTv\Test\Shared\Infrastructure\Behat\ApiFeatureContext:
connections: '@codely.infrastructure.database_connections'
publisher: '@codely.mooc.domain_event_publisher'
bus: '@codely.mooc.event_bus'
Expand All @@ -32,7 +32,7 @@ api:
user:
paths: [ tests/EntryPoint/mooc_backend/features/user ]
contexts:
- CodelyTv\Test\Infrastructure\Behat\ApiFeatureContext:
- CodelyTv\Test\Shared\Infrastructure\Behat\ApiFeatureContext:
connections: '@codely.infrastructure.database_connections'
publisher: '@codely.mooc.domain_event_publisher'
bus: '@codely.mooc.event_bus'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class ConsoleContext implements Context
public function iRunTheApplicationConsole($app)
{
$command = './bin/console';
$applicationDirectory = sprintf('%s/../../../../applications/%s', __DIR__, $app);
$applicationDirectory = sprintf('%s/../../../../../applications/%s', __DIR__, $app);

$this->runProcess(new Process($command, $applicationDirectory));
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Shared/Infrastructure/PHPUnit/FunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace CodelyTv\Test\Shared\Infrastructure\PHPUnit;

use CodelyTv\Api\ApiKernel;
use CodelyTv\CodelyKernel;
use CodelyTv\MoocBackend\MoocBackendKernel;

abstract class FunctionalTestCase extends UnitTestCase
{
/** @var ApiKernel */
/** @var MoocBackendKernel */
private $kernel;

protected function setUp()
Expand Down

0 comments on commit cafd1b2

Please sign in to comment.