Code Duplication    Length = 18-19 lines in 2 locations

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

@@ 5687-5704 (lines=18) @@
5684
     *
5685
     * @param ContentInfo $contentInfo
5686
     */
5687
    private function assertDefaultContentStates(ContentInfo $contentInfo)
5688
    {
5689
        $objectStateService = $this->getRepository()->getObjectStateService();
5690
5691
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
5692
5693
        foreach ($objectStateGroups as $objectStateGroup) {
5694
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
5695
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
5696
                // Only check the first object state which is the default one.
5697
                $this->assertEquals(
5698
                    $objectState,
5699
                    $contentState
5700
                );
5701
                break;
5702
            }
5703
        }
5704
    }
5705
5706
    /**
5707
     * Assert that given Content has no references to a translation specified by the $languageCode.

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

@@ 2162-2180 (lines=19) @@
2159
     *
2160
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
2161
     */
2162
    private function assertDefaultContentStates(ContentInfo $contentInfo)
2163
    {
2164
        $repository = $this->getRepository();
2165
        $objectStateService = $repository->getObjectStateService();
2166
2167
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
2168
2169
        foreach ($objectStateGroups as $objectStateGroup) {
2170
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
2171
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
2172
                // Only check the first object state which is the default one.
2173
                $this->assertEquals(
2174
                    $objectState,
2175
                    $contentState
2176
                );
2177
                break;
2178
            }
2179
        }
2180
    }
2181
2182
    /**
2183
     * Test for the copySubtree() method.