Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
96.30% covered (success)
96.30%
26 / 27
75.00% covered (warning)
75.00%
3 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
BoundedContextFactory
96.30% covered (success)
96.30%
26 / 27
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%
12 / 12
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\FakeLogin;
11use Apie\Fixtures\Actions\StaticActionExample;
12use Apie\Fixtures\Entities\Order;
13use Apie\Fixtures\Entities\Polymorphic\Animal;
14use Apie\Fixtures\Entities\UserWithAddress;
15use Apie\Fixtures\Entities\UserWithAutoincrementKey;
16use ReflectionClass;
17use ReflectionMethod;
18
19final 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}