ModelSerializationTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testModelSerialization() 0 14 1
1
<?php
2
3
namespace MaksimM\CompositePrimaryKeys\Tests;
4
5
use Illuminate\Foundation\Bus\DispatchesJobs;
6
use MaksimM\CompositePrimaryKeys\Tests\Stubs\TestJob;
7
use MaksimM\CompositePrimaryKeys\Tests\Stubs\TestUser;
8
9
class ModelSerializationTest extends CompositeKeyBaseUnit
10
{
11
    use DispatchesJobs;
12
13
    /** @test */
14
    public function testModelSerialization()
15
    {
16
        /**
17
         * @var TestUser $model
18
         */
19
        $model = TestUser::find([
20
            'user_id'         => 1,
21
            'organization_id' => 100,
22
        ]);
23
        $this->assertEquals(0, $model->counter);
24
        $job = new TestJob($model);
25
        $this->dispatch($job);
26
        $model->refresh();
27
        $this->assertEquals(3333, $model->counter);
28
    }
29
}
30