Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 2142-2160 (lines=19) @@
2139
     *
2140
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
2141
     */
2142
    private function assertDefaultContentStates(ContentInfo $contentInfo)
2143
    {
2144
        $repository = $this->getRepository();
2145
        $objectStateService = $repository->getObjectStateService();
2146
2147
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
2148
2149
        foreach ($objectStateGroups as $objectStateGroup) {
2150
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
2151
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
2152
                // Only check the first object state which is the default one.
2153
                $this->assertEquals(
2154
                    $objectState,
2155
                    $contentState
2156
                );
2157
                break;
2158
            }
2159
        }
2160
    }
2161
2162
    /**
2163
     * Test for the copySubtree() method.

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

@@ 6107-6125 (lines=19) @@
6104
     *
6105
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
6106
     */
6107
    private function assertDefaultContentStates(ContentInfo $contentInfo)
6108
    {
6109
        $repository = $this->getRepository();
6110
        $objectStateService = $repository->getObjectStateService();
6111
6112
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
6113
6114
        foreach ($objectStateGroups as $objectStateGroup) {
6115
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
6116
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
6117
                // Only check the first object state which is the default one.
6118
                $this->assertEquals(
6119
                    $objectState,
6120
                    $contentState
6121
                );
6122
                break;
6123
            }
6124
        }
6125
    }
6126
6127
    /**
6128
     * Assert that given Content has no references to a translation specified by the $languageCode.