Code Duplication    Length = 58-59 lines in 2 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Content/UrlAlias/UrlAliasHandlerTest.php 2 locations

@@ 1787-1844 (lines=58) @@
1784
     * @group cleanup
1785
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation
1786
     */
1787
    public function testPublishUrlAliasReuseHistoryCleanup()
1788
    {
1789
        $handler = $this->getHandler();
1790
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_cleanup_history.php');
1791
1792
        $handler->publishUrlAliasForLocation(314, 2, 'tri', 'cro-HR', false);
1793
1794
        $urlAlias = $handler->lookup('jedan');
1795
        $this->assertEquals(
1796
            new UrlAlias(
1797
                array(
1798
                    'id' => '0-' . md5('jedan'),
1799
                    'type' => UrlAlias::LOCATION,
1800
                    'destination' => 314,
1801
                    'pathData' => array(
1802
                        array(
1803
                            'always-available' => false,
1804
                            'translations' => array('cro-HR' => 'jedan'),
1805
                        ),
1806
                    ),
1807
                    'languageCodes' => array('cro-HR'),
1808
                    'alwaysAvailable' => false,
1809
                    'isHistory' => true,
1810
                    'isCustom' => false,
1811
                    'forward' => false,
1812
                )
1813
            ),
1814
            $urlAlias
1815
        );
1816
1817
        $urlAlias = $handler->lookup('tri');
1818
        $this->assertEquals(
1819
            new UrlAlias(
1820
                array(
1821
                    'id' => '0-' . md5('tri'),
1822
                    'type' => UrlAlias::LOCATION,
1823
                    'destination' => 314,
1824
                    'pathData' => array(
1825
                        array(
1826
                            'always-available' => false,
1827
                            'translations' => array(
1828
                                'cro-HR' => 'tri',
1829
                                'eng-GB' => 'dva',
1830
                            ),
1831
                        ),
1832
                    ),
1833
                    'languageCodes' => array(
1834
                        'cro-HR',
1835
                    ),
1836
                    'alwaysAvailable' => false,
1837
                    'isHistory' => false,
1838
                    'isCustom' => false,
1839
                    'forward' => false,
1840
                )
1841
            ),
1842
            $urlAlias
1843
        );
1844
    }
1845
1846
    /**
1847
     * Test for the publishUrlAliasForLocation() method.
@@ 1852-1910 (lines=59) @@
1849
     * @group cleanup
1850
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation
1851
     */
1852
    public function testPublishUrlAliasReuseAutogeneratedCleanup()
1853
    {
1854
        $handler = $this->getHandler();
1855
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_cleanup_reusing.php');
1856
1857
        $handler->publishUrlAliasForLocation(314, 2, 'dva', 'cro-HR', false);
1858
1859
        $urlAlias = $handler->lookup('jedan');
1860
        $this->assertEquals(
1861
            new UrlAlias(
1862
                array(
1863
                    'id' => '0-' . md5('jedan'),
1864
                    'type' => UrlAlias::LOCATION,
1865
                    'destination' => 314,
1866
                    'pathData' => array(
1867
                        array(
1868
                            'always-available' => false,
1869
                            'translations' => array('cro-HR' => 'jedan'),
1870
                        ),
1871
                    ),
1872
                    'languageCodes' => array('cro-HR'),
1873
                    'alwaysAvailable' => false,
1874
                    'isHistory' => true,
1875
                    'isCustom' => false,
1876
                    'forward' => false,
1877
                )
1878
            ),
1879
            $urlAlias
1880
        );
1881
1882
        $urlAlias = $handler->lookup('dva');
1883
        $this->assertEquals(
1884
            new UrlAlias(
1885
                array(
1886
                    'id' => '0-' . md5('dva'),
1887
                    'type' => UrlAlias::LOCATION,
1888
                    'destination' => 314,
1889
                    'pathData' => array(
1890
                        array(
1891
                            'always-available' => false,
1892
                            'translations' => array(
1893
                                'cro-HR' => 'dva',
1894
                                'eng-GB' => 'dva',
1895
                            ),
1896
                        ),
1897
                    ),
1898
                    'languageCodes' => array(
1899
                        'cro-HR',
1900
                        'eng-GB',
1901
                    ),
1902
                    'alwaysAvailable' => false,
1903
                    'isHistory' => false,
1904
                    'isCustom' => false,
1905
                    'forward' => false,
1906
                )
1907
            ),
1908
            $urlAlias
1909
        );
1910
    }
1911
1912
    /**
1913
     * Test for the createCustomUrlAlias() method.