Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 1531-1549 (lines=19) @@
1528
     *
1529
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
1530
     */
1531
    private function assertDefaultContentStates(ContentInfo $contentInfo)
1532
    {
1533
        $repository = $this->getRepository();
1534
        $objectStateService = $repository->getObjectStateService();
1535
1536
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
1537
1538
        foreach ($objectStateGroups as $objectStateGroup) {
1539
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
1540
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
1541
                // Only check the first object state which is the default one.
1542
                $this->assertEquals(
1543
                    $objectState,
1544
                    $contentState
1545
                );
1546
                break;
1547
            }
1548
        }
1549
    }
1550
1551
    /**
1552
     * Test for the copySubtree() method.

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

@@ 4784-4802 (lines=19) @@
4781
     *
4782
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
4783
     */
4784
    private function assertDefaultContentStates(ContentInfo $contentInfo)
4785
    {
4786
        $repository = $this->getRepository();
4787
        $objectStateService = $repository->getObjectStateService();
4788
4789
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
4790
4791
        foreach ($objectStateGroups as $objectStateGroup) {
4792
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
4793
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
4794
                // Only check the first object state which is the default one.
4795
                $this->assertEquals(
4796
                    $objectState,
4797
                    $contentState
4798
                );
4799
                break;
4800
            }
4801
        }
4802
    }
4803
4804
    /**
4805
     * Returns the default fixture of fields used in most tests.