Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 4760-4778 (lines=19) @@
4757
     *
4758
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
4759
     */
4760
    private function assertDefaultContentStates(ContentInfo $contentInfo)
4761
    {
4762
        $repository = $this->getRepository();
4763
        $objectStateService = $repository->getObjectStateService();
4764
4765
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
4766
4767
        foreach ($objectStateGroups as $objectStateGroup) {
4768
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
4769
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
4770
                // Only check the first object state which is the default one.
4771
                $this->assertEquals(
4772
                    $objectState,
4773
                    $contentState
4774
                );
4775
                break;
4776
            }
4777
        }
4778
    }
4779
4780
    /**
4781
     * Returns the default fixture of fields used in most tests.

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

@@ 1455-1473 (lines=19) @@
1452
     *
1453
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
1454
     */
1455
    private function assertDefaultContentStates(ContentInfo $contentInfo)
1456
    {
1457
        $repository = $this->getRepository();
1458
        $objectStateService = $repository->getObjectStateService();
1459
1460
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
1461
1462
        foreach ($objectStateGroups as $objectStateGroup) {
1463
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
1464
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
1465
                // Only check the first object state which is the default one.
1466
                $this->assertEquals(
1467
                    $objectState,
1468
                    $contentState
1469
                );
1470
                break;
1471
            }
1472
        }
1473
    }
1474
1475
    /**
1476
     * Test for the copySubtree() method.