Code Duplication    Length = 17-17 lines in 4 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Content/Gateway/DoctrineDatabaseTest.php 4 locations

@@ 1865-1881 (lines=17) @@
1862
     *
1863
     * @return int
1864
     */
1865
    protected function countContentFields($contentId = null)
1866
    {
1867
        $query = $this->getDatabaseHandler()->createSelectQuery();
1868
        $query->select('count(*)')
1869
            ->from('ezcontentobject_attribute');
1870
1871
        if ($contentId !== null) {
1872
            $query->where(
1873
                'contentobject_id=' . $contentId
1874
            );
1875
        }
1876
1877
        $statement = $query->prepare();
1878
        $statement->execute();
1879
1880
        return (int)$statement->fetchColumn();
1881
    }
1882
1883
    /**
1884
     * Counts the number of versions.
@@ 1890-1906 (lines=17) @@
1887
     *
1888
     * @return int
1889
     */
1890
    protected function countContentVersions($contentId = null)
1891
    {
1892
        $query = $this->getDatabaseHandler()->createSelectQuery();
1893
        $query->select('count(*)')
1894
            ->from('ezcontentobject_version');
1895
1896
        if ($contentId !== null) {
1897
            $query->where(
1898
                'contentobject_id=' . $contentId
1899
            );
1900
        }
1901
1902
        $statement = $query->prepare();
1903
        $statement->execute();
1904
1905
        return (int)$statement->fetchColumn();
1906
    }
1907
1908
    /**
1909
     * Counts the number of content names.
@@ 1915-1931 (lines=17) @@
1912
     *
1913
     * @return int
1914
     */
1915
    protected function countContentNames($contentId = null)
1916
    {
1917
        $query = $this->getDatabaseHandler()->createSelectQuery();
1918
        $query->select('count(*)')
1919
            ->from('ezcontentobject_name');
1920
1921
        if ($contentId !== null) {
1922
            $query->where(
1923
                'contentobject_id=' . $contentId
1924
            );
1925
        }
1926
1927
        $statement = $query->prepare();
1928
        $statement->execute();
1929
1930
        return (int)$statement->fetchColumn();
1931
    }
1932
1933
    /**
1934
     * Counts the number of content objects.
@@ 1940-1956 (lines=17) @@
1937
     *
1938
     * @return int
1939
     */
1940
    protected function countContent($contentId = null)
1941
    {
1942
        $query = $this->getDatabaseHandler()->createSelectQuery();
1943
        $query->select('count(*)')
1944
            ->from('ezcontentobject');
1945
1946
        if ($contentId !== null) {
1947
            $query->where(
1948
                'id=' . $contentId
1949
            );
1950
        }
1951
1952
        $statement = $query->prepare();
1953
        $statement->execute();
1954
1955
        return (int)$statement->fetchColumn();
1956
    }
1957
1958
    /**
1959
     * Stores $fixture in $file to be required as a fixture.