Code Duplication    Length = 24-26 lines in 4 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Content/LocationHandlerTest.php 3 locations

@@ 124-149 (lines=26) @@
121
        $this->assertEquals(2, count($this->getLocationHandler()->loadSubtreeIds(77)));
122
    }
123
124
    public function testLoadLocationByRemoteId()
125
    {
126
        $handler = $this->getLocationHandler();
127
128
        $this->locationGateway
129
            ->expects($this->once())
130
            ->method('getBasicNodeDataByRemoteId')
131
            ->with('abc123')
132
            ->will(
133
                $this->returnValue(
134
                    array(
135
                        'node_id' => 77,
136
                    )
137
                )
138
            );
139
140
        $this->locationMapper
141
            ->expects($this->once())
142
            ->method('createLocationFromRow')
143
            ->with(array('node_id' => 77))
144
            ->will($this->returnValue(new \eZ\Publish\SPI\Persistence\Content\Location()));
145
146
        $location = $handler->loadByRemoteId('abc123');
147
148
        $this->assertTrue($location instanceof \eZ\Publish\SPI\Persistence\Content\Location);
149
    }
150
151
    public function testLoadLocationsByContent()
152
    {
@@ 151-174 (lines=24) @@
148
        $this->assertTrue($location instanceof \eZ\Publish\SPI\Persistence\Content\Location);
149
    }
150
151
    public function testLoadLocationsByContent()
152
    {
153
        $handler = $this->getLocationHandler();
154
155
        $this->locationGateway
156
            ->expects($this->once())
157
            ->method('loadLocationDataByContent')
158
            ->with(23, 42)
159
            ->will(
160
                $this->returnValue(
161
                    array()
162
                )
163
            );
164
165
        $this->locationMapper
166
            ->expects($this->once())
167
            ->method('createLocationsFromRows')
168
            ->with(array())
169
            ->will($this->returnValue(array('a', 'b')));
170
171
        $locations = $handler->loadLocationsByContent(23, 42);
172
173
        $this->assertInternalType('array', $locations);
174
    }
175
176
    public function loadParentLocationsForDraftContent()
177
    {
@@ 176-199 (lines=24) @@
173
        $this->assertInternalType('array', $locations);
174
    }
175
176
    public function loadParentLocationsForDraftContent()
177
    {
178
        $handler = $this->getLocationHandler();
179
180
        $this->locationGateway
181
            ->expects($this->once())
182
            ->method('loadParentLocationsDataForDraftContent')
183
            ->with(23)
184
            ->will(
185
                $this->returnValue(
186
                    array()
187
                )
188
            );
189
190
        $this->locationMapper
191
            ->expects($this->once())
192
            ->method('createLocationsFromRows')
193
            ->with(array())
194
            ->will($this->returnValue(array('a', 'b')));
195
196
        $locations = $handler->loadParentLocationsForDraftContent(23);
197
198
        $this->assertInternalType('array', $locations);
199
    }
200
201
    public function testMoveSubtree()
202
    {

eZ/Publish/Core/Persistence/Legacy/Tests/Content/TreeHandlerTest.php 1 location

@@ 336-361 (lines=26) @@
333
        $treeHandler->changeMainLocation(12, 34);
334
    }
335
336
    public function testLoadLocation()
337
    {
338
        $treeHandler = $this->getTreeHandler();
339
340
        $this->getLocationGatewayMock()
341
            ->expects($this->once())
342
            ->method('getBasicNodeData')
343
            ->with(77)
344
            ->will(
345
                $this->returnValue(
346
                    array(
347
                        'node_id' => 77,
348
                    )
349
                )
350
            );
351
352
        $this->getLocationMapperMock()
353
            ->expects($this->once())
354
            ->method('createLocationFromRow')
355
            ->with(array('node_id' => 77))
356
            ->will($this->returnValue(new Location()));
357
358
        $location = $treeHandler->loadLocation(77);
359
360
        $this->assertTrue($location instanceof Location);
361
    }
362
363
    /**
364
     * @var \PHPUnit_Framework_MockObject_MockObject|\eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway