Code Duplication    Length = 58-59 lines in 2 locations

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

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