Code Duplication    Length = 58-59 lines in 2 locations

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

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