Completed
Push — master ( f2025c...16072a )
by Lars
06:18
created

SwitchModelsTest::two_models_switch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 10

Duplication

Lines 16
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 16
loc 16
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
namespace LarsJanssen\IncrementDecrement\Test\core;
3
4
use LarsJanssen\IncrementDecrement\Test\TestCase;
5
use LarsJanssen\IncrementDecrement\Test\TestModel;
6
7 View Code Duplication
class SwitchModelsTest extends TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    /** @test */
10
    public function two_models_switch()
11
    {
12
        $row1 = TestModel::where('name', 'food')->first();
13
        $row2 = TestModel::where('name', 'people')->first();
14
15
        $this->assertEquals(1, $row1->order);
16
        $this->assertEquals(5, $row2->order);
17
18
        $this->order->switchModels($row1, $row2);
19
20
        $row1 = TestModel::where('name', 'food')->first();
21
        $row2 = TestModel::where('name', 'people')->first();
22
23
        $this->assertEquals(5, $row1->order);
24
        $this->assertEquals(1, $row2->order);
25
    }
26
}