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\PizzaWasBaked; |
||||
12 | use PHPUnit\Framework\TestCase; |
||||
13 | |||||
14 | final class DomainEventTest extends TestCase |
||||
15 | { |
||||
16 | 1 | public function testFromNative(): void |
|||
17 | { |
||||
18 | 1 | $ingredients = ['mushrooms', 'tomatoes', 'onions']; |
|||
19 | 1 | $pizzaWasBaked = PizzaWasBaked::fromNative([ |
|||
20 | 1 | 'pizzaId' => 'pizza-42-6-23', |
|||
21 | 1 | 'revision' => 1, |
|||
22 | 1 | 'ingredients' => $ingredients |
|||
23 | ]); |
||||
24 | 1 | $this->assertEquals('pizza-42-6-23', $pizzaWasBaked->getPizzaId()); |
|||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
25 | 1 | $this->assertEquals(1, $pizzaWasBaked->getRevision()->toNative()); |
|||
0 ignored issues
–
show
It seems like
getRevision() 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 | $this->assertEquals($ingredients, $pizzaWasBaked->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
![]() |
|||||
27 | 1 | } |
|||
28 | |||||
29 | 1 | public function testToNative(): void |
|||
30 | { |
||||
31 | $pizzaWasBakedArray = [ |
||||
32 | 1 | 'pizzaId' => 'pizza-42-6-23', |
|||
33 | 'revision' => 1, |
||||
34 | 'ingredients' => ['mushrooms', 'tomatoes', 'onions'] |
||||
35 | ]; |
||||
36 | 1 | $this->assertEquals($pizzaWasBakedArray, PizzaWasBaked::fromNative($pizzaWasBakedArray)->toNative()); |
|||
37 | 1 | } |
|||
38 | } |
||||
39 |