Issues (10)

tests/Aggregate/DomainEventTest.php (3 issues)

Labels
Severity
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
It seems like getPizzaId() 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 ignore-call  annotation

24
        $this->assertEquals('pizza-42-6-23', $pizzaWasBaked->/** @scrutinizer ignore-call */ getPizzaId());
Loading history...
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 ignore-call  annotation

25
        $this->assertEquals(1, $pizzaWasBaked->/** @scrutinizer ignore-call */ getRevision()->toNative());
Loading history...
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 ignore-call  annotation

26
        $this->assertEquals($ingredients, $pizzaWasBaked->/** @scrutinizer ignore-call */ getIngredients()->toNative());
Loading history...
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