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

SingleKeyModelSerializationTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 1
eloc 8
c 1
b 1
f 0
dl 0
loc 16
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testModelSerialization() 0 11 1
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