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