Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 1746-1764 (lines=19) @@
1743
     *
1744
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
1745
     */
1746
    private function assertDefaultContentStates(ContentInfo $contentInfo)
1747
    {
1748
        $repository = $this->getRepository();
1749
        $objectStateService = $repository->getObjectStateService();
1750
1751
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
1752
1753
        foreach ($objectStateGroups as $objectStateGroup) {
1754
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
1755
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
1756
                // Only check the first object state which is the default one.
1757
                $this->assertEquals(
1758
                    $objectState,
1759
                    $contentState
1760
                );
1761
                break;
1762
            }
1763
        }
1764
    }
1765
1766
    /**
1767
     * Test for the copySubtree() method.

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

@@ 5016-5034 (lines=19) @@
5013
     *
5014
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
5015
     */
5016
    private function assertDefaultContentStates(ContentInfo $contentInfo)
5017
    {
5018
        $repository = $this->getRepository();
5019
        $objectStateService = $repository->getObjectStateService();
5020
5021
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
5022
5023
        foreach ($objectStateGroups as $objectStateGroup) {
5024
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
5025
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
5026
                // Only check the first object state which is the default one.
5027
                $this->assertEquals(
5028
                    $objectState,
5029
                    $contentState
5030
                );
5031
                break;
5032
            }
5033
        }
5034
    }
5035
5036
    /**
5037
     * Returns the default fixture of fields used in most tests.