Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 6031-6049 (lines=19) @@
6028
     *
6029
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
6030
     */
6031
    private function assertDefaultContentStates(ContentInfo $contentInfo)
6032
    {
6033
        $repository = $this->getRepository();
6034
        $objectStateService = $repository->getObjectStateService();
6035
6036
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
6037
6038
        foreach ($objectStateGroups as $objectStateGroup) {
6039
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
6040
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
6041
                // Only check the first object state which is the default one.
6042
                $this->assertEquals(
6043
                    $objectState,
6044
                    $contentState
6045
                );
6046
                break;
6047
            }
6048
        }
6049
    }
6050
6051
    /**
6052
     * Assert that given Content has no references to a translation specified by the $languageCode.

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

@@ 1928-1946 (lines=19) @@
1925
     *
1926
     * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
1927
     */
1928
    private function assertDefaultContentStates(ContentInfo $contentInfo)
1929
    {
1930
        $repository = $this->getRepository();
1931
        $objectStateService = $repository->getObjectStateService();
1932
1933
        $objectStateGroups = $objectStateService->loadObjectStateGroups();
1934
1935
        foreach ($objectStateGroups as $objectStateGroup) {
1936
            $contentState = $objectStateService->getContentState($contentInfo, $objectStateGroup);
1937
            foreach ($objectStateService->loadObjectStates($objectStateGroup) as $objectState) {
1938
                // Only check the first object state which is the default one.
1939
                $this->assertEquals(
1940
                    $objectState,
1941
                    $contentState
1942
                );
1943
                break;
1944
            }
1945
        }
1946
    }
1947
1948
    /**
1949
     * Test for the copySubtree() method.