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