Code Duplication    Length = 19-19 lines in 2 locations

eZ/Publish/API/Repository/Tests/LocationServiceTest.php 1 location

@@ 1568-1586 (lines=19) @@
1565
     *
1566
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
1567
     */
1568
    private function assertDefaultContentStates(ContentInfo $contentInfo)
1569
    {
1570
        $repository = $this->getRepository();
1571
        $objectStateService = $repository->getObjectStateService();
1572
1573
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
1574
1575
        foreach ($objectStateGroups as $objectStateGroup) {
1576
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
1577
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
1578
                // Only check the first object state which is the default one.
1579
                $this->assertEquals(
1580
                    $objectState,
1581
                    $contentState
1582
                );
1583
                break;
1584
            }
1585
        }
1586
    }
1587
1588
    /**
1589
     * Test for the copySubtree() method.

eZ/Publish/API/Repository/Tests/ContentServiceTest.php 1 location

@@ 5273-5291 (lines=19) @@
5270
     *
5271
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
5272
     */
5273
    private function assertDefaultContentStates(ContentInfo $contentInfo)
5274
    {
5275
        $repository = $this->getRepository();
5276
        $objectStateService = $repository->getObjectStateService();
5277
5278
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
5279
5280
        foreach ($objectStateGroups as $objectStateGroup) {
5281
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
5282
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
5283
                // Only check the first object state which is the default one.
5284
                $this->assertEquals(
5285
                    $objectState,
5286
                    $contentState
5287
                );
5288
                break;
5289
            }
5290
        }
5291
    }
5292
5293
    /**
5294
     * Returns the default fixture of fields used in most tests.