Passed
Push — master ( 5c4c7a...89ffe1 )
by Stephen
17:00
created

modelAttributeAssertions()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 2
nop 3
dl 0
loc 4
rs 10
1
<?php
2
3
4
namespace Sfneal\Testing\Utils\Traits;
5
6
7
use Illuminate\Database\Eloquent\Model;
8
9
trait ModelAttributeAssertions
10
{
11
    /**
12
     * Execute model assertions.
13
     *
14
     * @param array $data
15
     * @param Model $model
16
     * @param string $assertionMethod
17
     * @return void
18
     */
19
    private function modelAttributeAssertions(array $data, Model $model, string $assertionMethod = 'assertSame'): void
20
    {
21
        foreach ($data as $attribute => $value) {
22
            $this->{$assertionMethod}($value, $model->{$attribute});
23
        }
24
    }
25
}
26