Issues (64)

tests/SingleKeyModelSerializationTest.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace MaksimM\CompositePrimaryKeys\Tests;
4
5
use Illuminate\Foundation\Bus\DispatchesJobs;
6
use MaksimM\CompositePrimaryKeys\Tests\Stubs\TestBinaryRoleHex;
7
use MaksimM\CompositePrimaryKeys\Tests\Stubs\TestSingleBinaryKeyJob;
8
use MaksimM\CompositePrimaryKeys\Tests\Stubs\TestUser;
9
10
class SingleKeyModelSerializationTest extends CompositeKeyBaseUnit
11
{
12
    use DispatchesJobs;
13
14
    /** @test */
15
    public function testModelSerialization()
16
    {
17
        /**
18
         * @var TestUser $model
19
         */
20
        $model = TestBinaryRoleHex::first();
21
        $this->assertEquals('Foo', $model->name);
22
        $job = new TestSingleBinaryKeyJob($model);
0 ignored issues
show
$model of type MaksimM\CompositePrimaryKeys\Tests\Stubs\TestUser is incompatible with the type MaksimM\CompositePrimary...Stubs\TestBinaryRoleHex expected by parameter $binaryRole of MaksimM\CompositePrimary...ryKeyJob::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
        $job = new TestSingleBinaryKeyJob(/** @scrutinizer ignore-type */ $model);
Loading history...
23
        $this->dispatch($job);
24
        $model->refresh();
25
        $this->assertEquals('Bar', $model->name);
26
    }
27
}
28