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

ModelAttributeAssertions   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A modelAttributeAssertions() 0 4 2
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