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