Code Duplication    Length = 17-17 lines in 4 locations

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

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