Code Duplication    Length = 16-17 lines in 7 locations

tests/GraphNodes/GraphEventTest.php 4 locations

@@ 42-57 (lines=16) @@
39
        $this->responseMock = m::mock('\Facebook\FacebookResponse');
40
    }
41
42
    public function testCoverGetsCastAsGraphCoverPhoto()
43
    {
44
        $dataFromGraph = [
45
            'cover' => ['id' => '1337']
46
        ];
47
48
        $this->responseMock
49
            ->shouldReceive('getDecodedBody')
50
            ->once()
51
            ->andReturn($dataFromGraph);
52
        $factory = new GraphNodeFactory($this->responseMock);
53
        $graphObject = $factory->makeGraphEvent();
54
55
        $cover = $graphObject->getCover();
56
        $this->assertInstanceOf('\Facebook\GraphNodes\GraphCoverPhoto', $cover);
57
    }
58
59
    public function testPlaceGetsCastAsGraphPage()
60
    {
@@ 59-74 (lines=16) @@
56
        $this->assertInstanceOf('\Facebook\GraphNodes\GraphCoverPhoto', $cover);
57
    }
58
59
    public function testPlaceGetsCastAsGraphPage()
60
    {
61
        $dataFromGraph = [
62
            'place' => ['id' => '1337']
63
        ];
64
65
        $this->responseMock
66
            ->shouldReceive('getDecodedBody')
67
            ->once()
68
            ->andReturn($dataFromGraph);
69
        $factory = new GraphNodeFactory($this->responseMock);
70
        $graphObject = $factory->makeGraphEvent();
71
72
        $place = $graphObject->getPlace();
73
        $this->assertInstanceOf('\Facebook\GraphNodes\GraphPage', $place);
74
    }
75
76
    public function testPictureGetsCastAsGraphPicture()
77
    {
@@ 76-91 (lines=16) @@
73
        $this->assertInstanceOf('\Facebook\GraphNodes\GraphPage', $place);
74
    }
75
76
    public function testPictureGetsCastAsGraphPicture()
77
    {
78
        $dataFromGraph = [
79
            'picture' => ['id' => '1337']
80
        ];
81
82
        $this->responseMock
83
            ->shouldReceive('getDecodedBody')
84
            ->once()
85
            ->andReturn($dataFromGraph);
86
        $factory = new GraphNodeFactory($this->responseMock);
87
        $graphObject = $factory->makeGraphEvent();
88
89
        $picture = $graphObject->getPicture();
90
        $this->assertInstanceOf('\Facebook\GraphNodes\GraphPicture', $picture);
91
    }
92
93
    public function testParentGroupGetsCastAsGraphGroup()
94
    {
@@ 93-108 (lines=16) @@
90
        $this->assertInstanceOf('\Facebook\GraphNodes\GraphPicture', $picture);
91
    }
92
93
    public function testParentGroupGetsCastAsGraphGroup()
94
    {
95
        $dataFromGraph = [
96
            'parent_group' => ['id' => '1337']
97
        ];
98
99
        $this->responseMock
100
            ->shouldReceive('getDecodedBody')
101
            ->once()
102
            ->andReturn($dataFromGraph);
103
        $factory = new GraphNodeFactory($this->responseMock);
104
        $graphObject = $factory->makeGraphEvent();
105
106
        $parentGroup = $graphObject->getParentGroup();
107
        $this->assertInstanceOf('\Facebook\GraphNodes\GraphGroup', $parentGroup);
108
    }
109
}
110

tests/GraphNodes/GraphGroupTest.php 2 locations

@@ 42-57 (lines=16) @@
39
        $this->responseMock = m::mock('\Facebook\FacebookResponse');
40
    }
41
42
    public function testCoverGetsCastAsGraphCoverPhoto()
43
    {
44
        $dataFromGraph = [
45
            'cover' => ['id' => '1337']
46
        ];
47
48
        $this->responseMock
49
            ->shouldReceive('getDecodedBody')
50
            ->once()
51
            ->andReturn($dataFromGraph);
52
        $factory = new GraphNodeFactory($this->responseMock);
53
        $graphNode = $factory->makeGraphGroup();
54
55
        $cover = $graphNode->getCover();
56
        $this->assertInstanceOf('\Facebook\GraphNodes\GraphCoverPhoto', $cover);
57
    }
58
59
    public function testVenueGetsCastAsGraphLocation()
60
    {
@@ 59-74 (lines=16) @@
56
        $this->assertInstanceOf('\Facebook\GraphNodes\GraphCoverPhoto', $cover);
57
    }
58
59
    public function testVenueGetsCastAsGraphLocation()
60
    {
61
        $dataFromGraph = [
62
            'venue' => ['id' => '1337']
63
        ];
64
65
        $this->responseMock
66
            ->shouldReceive('getDecodedBody')
67
            ->once()
68
            ->andReturn($dataFromGraph);
69
        $factory = new GraphNodeFactory($this->responseMock);
70
        $graphNode = $factory->makeGraphGroup();
71
72
        $venue = $graphNode->getVenue();
73
        $this->assertInstanceOf('\Facebook\GraphNodes\GraphLocation', $venue);
74
    }
75
}
76

tests/GraphNodes/GraphUserTest.php 1 location

@@ 42-58 (lines=17) @@
39
        $this->responseMock = m::mock('\\Facebook\\FacebookResponse');
40
    }
41
42
    public function testDatesGetCastToDateTime()
43
    {
44
        $dataFromGraph = [
45
            'updated_time' => '2016-04-26 13:22:05',
46
        ];
47
48
        $this->responseMock
49
            ->shouldReceive('getDecodedBody')
50
            ->once()
51
            ->andReturn($dataFromGraph);
52
        $factory = new GraphNodeFactory($this->responseMock);
53
        $graphNode = $factory->makeGraphUser();
54
55
        $updatedTime = $graphNode->getField('updated_time');
56
57
        $this->assertInstanceOf('DateTime', $updatedTime);
58
    }
59
60
    public function testBirthdaysGetCastToBirthday()
61
    {