Completed
Push — master ( f1a3d7...431755 )
by Matt
07:09
created

ItemTest::testSetResourceKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php namespace League\Fractal\Test\Resource;
2
3
use League\Fractal\Resource\Item;
4
use Mockery;
5
use PHPUnit\Framework\TestCase;
6
7 View Code Duplication
class ItemTest 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
    protected $simpleItem = ['foo' => 'bar'];
10
11
    public function testGetData()
12
    {
13
        $item = new Item($this->simpleItem, function () {});
14
15
        $this->assertSame($item->getData(), $this->simpleItem);
16
    }
17
18
    public function testGetTransformer()
19
    {
20
        $item = new Item($this->simpleItem, function () {});
21
22
        $this->assertTrue(is_callable($item->getTransformer()));
23
24
        $transformer = 'thismightbeacallablestring';
25
        $item = new Item($this->simpleItem, $transformer);
26
27
        $this->assertSame($item->getTransformer(), $transformer);
28
    }
29
30
    /**
31
     * @covers \League\Fractal\Resource\Item::setResourceKey
32
     */
33
    public function testSetResourceKey()
34
    {
35
        $item = Mockery::mock('League\Fractal\Resource\Item')->makePartial();
36
37
        $this->assertSame($item, $item->setResourceKey('foo'));
38
    }
39
40
    /**
41
     * @covers \League\Fractal\Resource\Item::getResourceKey
42
     */
43
    public function testGetResourceKey()
44
    {
45
        $item = Mockery::mock('League\Fractal\Resource\Item')->makePartial();
46
        $item->setResourceKey('foo');
47
48
        $this->assertSame('foo', $item->getResourceKey());
49
    }
50
}
51