Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 6069-6087 (lines=19) @@
6066
     *
6067
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
6068
     */
6069
    private function assertDefaultContentStates(ContentInfo $contentInfo)
6070
    {
6071
        $repository = $this->getRepository();
6072
        $objectStateService = $repository->getObjectStateService();
6073
6074
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
6075
6076
        foreach ($objectStateGroups as $objectStateGroup) {
6077
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
6078
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
6079
                // Only check the first object state which is the default one.
6080
                $this->assertEquals(
6081
                    $objectState,
6082
                    $contentState
6083
                );
6084
                break;
6085
            }
6086
        }
6087
    }
6088
6089
    /**
6090
     * Assert that given Content has no references to a translation specified by the $languageCode.

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.