1 | <?php declare(strict_types=1); |
||||
2 | /** |
||||
3 | * This file is part of the daikon-cqrs/event-sourcing project. |
||||
4 | * |
||||
5 | * For the full copyright and license information, please view the LICENSE |
||||
6 | * file that was distributed with this source code. |
||||
7 | */ |
||||
8 | |||||
9 | namespace Daikon\Tests\EventSourcing; |
||||
10 | |||||
11 | use Daikon\Tests\EventSourcing\Aggregate\Mock\BakePizza; |
||||
12 | use PHPUnit\Framework\TestCase; |
||||
13 | |||||
14 | final class CommandTest extends TestCase |
||||
15 | { |
||||
16 | 1 | public function testFromNative(): void |
|||
17 | { |
||||
18 | 1 | $ingredients = ['mushrooms', 'tomatoes', 'onions']; |
|||
19 | 1 | $bakePizza = BakePizza::fromNative([ |
|||
20 | 1 | 'pizzaId' => 'pizza-42-6-23', |
|||
21 | 1 | 'ingredients' => $ingredients |
|||
22 | ]); |
||||
23 | 1 | $this->assertEquals('pizza-42-6-23', $bakePizza->getPizzaId()); |
|||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
24 | 1 | $this->assertEquals(0, $bakePizza->getKnownAggregateRevision()->toNative()); |
|||
0 ignored issues
–
show
It seems like
getKnownAggregateRevision() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
25 | 1 | $this->assertEquals($ingredients, $bakePizza->getIngredients()->toNative()); |
|||
0 ignored issues
–
show
It seems like
getIngredients() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
26 | 1 | } |
|||
27 | |||||
28 | 1 | public function testToNative(): void |
|||
29 | { |
||||
30 | $bakePizzaArray = [ |
||||
31 | 1 | 'pizzaId' => 'pizza-42-6-23', |
|||
32 | 'revision' => 0, |
||||
33 | 'ingredients' => ['mushrooms', 'tomatoes', 'onions'] |
||||
34 | ]; |
||||
35 | 1 | $this->assertEquals($bakePizzaArray, BakePizza::fromNative($bakePizzaArray)->toNative()); |
|||
36 | 1 | } |
|||
37 | } |
||||
38 |