Passed
Push — master ( 19e483...625e7f )
by Mathieu
04:13
created

MyModel::bar()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace MathieuTu\JsonSyncer\Tests;
4
5
use MathieuTu\JsonSyncer\Helpers\RelationsInModelFinder;
6
7
class RelationsInModelFinderTest extends \PHPUnit\Framework\TestCase
8
{
9
    public function testhasOneOrMany()
10
    {
11
        $this->assertEquals(['foos', 'bar'], RelationsInModelFinder::hasOneOrMany(new MyModel()));
12
    }
13
}
14
15
// phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses
16
class MyModel extends \Illuminate\Database\Eloquent\Model
17
{
18
    public function foos()
19
    {
20
        return $this->hasMany('foo');
21
    }
22
23
    public function bar()
24
    {
25
        return $this->hasOne('bar');
26
    }
27
28
    public function baz()
29
    {
30
        return $this->hasManyThrough('baz', 'bar');
31
    }
32
33
    public function notARelation()
34
    {
35
        return 'this is not a relation!';
36
    }
37
38
    public function parent()
39
    {
40
        return $this->belongsTo('parent');
41
    }
42
}
43