Passed
Push — master ( 0b0de5...653fca )
by Maksim
04:50 queued 02:04
created

testModelSerialization()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 6
c 1
b 1
f 0
dl 0
loc 11
rs 10
cc 1
nc 1
nop 0
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
Bug introduced by
$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