Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
96.30% |
26 / 27 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
| BoundedContextFactory | |
96.30% |
26 / 27 |
|
75.00% |
3 / 4 |
4 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| createHashmap | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| createHashmapWithMultipleContexts | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
1 | |||
| createExample | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\Fixtures; |
| 3 | |
| 4 | use Apie\Core\BoundedContext\BoundedContext; |
| 5 | use Apie\Core\BoundedContext\BoundedContextHashmap; |
| 6 | use Apie\Core\BoundedContext\BoundedContextId; |
| 7 | use Apie\Core\Lists\ReflectionClassList; |
| 8 | use Apie\Core\Lists\ReflectionMethodList; |
| 9 | use Apie\Fixtures\Actions\BackgroundProcessExample; |
| 10 | use Apie\Fixtures\Actions\FakeLogin; |
| 11 | use Apie\Fixtures\Actions\StaticActionExample; |
| 12 | use Apie\Fixtures\Entities\Order; |
| 13 | use Apie\Fixtures\Entities\Polymorphic\Animal; |
| 14 | use Apie\Fixtures\Entities\UserWithAddress; |
| 15 | use Apie\Fixtures\Entities\UserWithAutoincrementKey; |
| 16 | use ReflectionClass; |
| 17 | use ReflectionMethod; |
| 18 | |
| 19 | final class BoundedContextFactory |
| 20 | { |
| 21 | private function __construct() |
| 22 | { |
| 23 | } |
| 24 | |
| 25 | public static function createHashmap(): BoundedContextHashmap |
| 26 | { |
| 27 | return new BoundedContextHashmap([ |
| 28 | 'default' => self::createExample(), |
| 29 | ]); |
| 30 | } |
| 31 | |
| 32 | public static function createHashmapWithMultipleContexts(): BoundedContextHashmap |
| 33 | { |
| 34 | return new BoundedContextHashmap([ |
| 35 | 'default' => self::createExample(), |
| 36 | 'other' => new BoundedContext( |
| 37 | new BoundedContextId('other'), |
| 38 | new ReflectionClassList([ |
| 39 | new ReflectionClass(UserWithAutoincrementKey::class), |
| 40 | new ReflectionClass(Animal::class), |
| 41 | ]), |
| 42 | new ReflectionMethodList(), |
| 43 | ) |
| 44 | ]); |
| 45 | } |
| 46 | |
| 47 | public static function createExample(): BoundedContext |
| 48 | { |
| 49 | return new BoundedContext( |
| 50 | new BoundedContextId('default'), |
| 51 | new ReflectionClassList([ |
| 52 | new ReflectionClass(UserWithAddress::class), |
| 53 | new ReflectionClass(Order::class) |
| 54 | ]), |
| 55 | new ReflectionMethodList([ |
| 56 | new ReflectionMethod(StaticActionExample::class, 'secretCode'), |
| 57 | new ReflectionMethod(BackgroundProcessExample::class, 'createBackgroundProcess'), |
| 58 | new ReflectionMethod(FakeLogin::class, 'verifyAuthentication'), |
| 59 | ]) |
| 60 | ); |
| 61 | } |
| 62 | } |