Issues (10)

tests/Aggregate/CommandTest.php (3 issues)

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
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

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

24
        $this->assertEquals(0, $bakePizza->/** @scrutinizer ignore-call */ getKnownAggregateRevision()->toNative());
Loading history...
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 ignore-call  annotation

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