Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 5765-5783 (lines=19) @@
5762
     *
5763
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
5764
     */
5765
    private function assertDefaultContentStates(ContentInfo $contentInfo)
5766
    {
5767
        $repository = $this->getRepository();
5768
        $objectStateService = $repository->getObjectStateService();
5769
5770
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
5771
5772
        foreach ($objectStateGroups as $objectStateGroup) {
5773
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
5774
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
5775
                // Only check the first object state which is the default one.
5776
                $this->assertEquals(
5777
                    $objectState,
5778
                    $contentState
5779
                );
5780
                break;
5781
            }
5782
        }
5783
    }
5784
5785
    /**
5786
     * Assert that given Content has no references to a translation specified by the $languageCode.

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

@@ 1664-1682 (lines=19) @@
1661
     *
1662
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
1663
     */
1664
    private function assertDefaultContentStates(ContentInfo $contentInfo)
1665
    {
1666
        $repository = $this->getRepository();
1667
        $objectStateService = $repository->getObjectStateService();
1668
1669
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
1670
1671
        foreach ($objectStateGroups as $objectStateGroup) {
1672
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
1673
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
1674
                // Only check the first object state which is the default one.
1675
                $this->assertEquals(
1676
                    $objectState,
1677
                    $contentState
1678
                );
1679
                break;
1680
            }
1681
        }
1682
    }
1683
1684
    /**
1685
     * Test for the copySubtree() method.