| @@ 1855-1912 (lines=58) @@ | ||
| 1852 | * @group cleanup |
|
| 1853 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
|
| 1854 | */ |
|
| 1855 | public function testPublishUrlAliasReuseHistoryCleanup() |
|
| 1856 | { |
|
| 1857 | $handler = $this->getHandler(); |
|
| 1858 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_cleanup_history.php'); |
|
| 1859 | ||
| 1860 | $handler->publishUrlAliasForLocation(314, 2, 'tri', 'cro-HR', false); |
|
| 1861 | ||
| 1862 | $urlAlias = $handler->lookup('jedan'); |
|
| 1863 | $this->assertEquals( |
|
| 1864 | new UrlAlias( |
|
| 1865 | array( |
|
| 1866 | 'id' => '0-' . md5('jedan'), |
|
| 1867 | 'type' => UrlAlias::LOCATION, |
|
| 1868 | 'destination' => 314, |
|
| 1869 | 'pathData' => array( |
|
| 1870 | array( |
|
| 1871 | 'always-available' => false, |
|
| 1872 | 'translations' => array('cro-HR' => 'jedan'), |
|
| 1873 | ), |
|
| 1874 | ), |
|
| 1875 | 'languageCodes' => array('cro-HR'), |
|
| 1876 | 'alwaysAvailable' => false, |
|
| 1877 | 'isHistory' => true, |
|
| 1878 | 'isCustom' => false, |
|
| 1879 | 'forward' => false, |
|
| 1880 | ) |
|
| 1881 | ), |
|
| 1882 | $urlAlias |
|
| 1883 | ); |
|
| 1884 | ||
| 1885 | $urlAlias = $handler->lookup('tri'); |
|
| 1886 | $this->assertEquals( |
|
| 1887 | new UrlAlias( |
|
| 1888 | array( |
|
| 1889 | 'id' => '0-' . md5('tri'), |
|
| 1890 | 'type' => UrlAlias::LOCATION, |
|
| 1891 | 'destination' => 314, |
|
| 1892 | 'pathData' => array( |
|
| 1893 | array( |
|
| 1894 | 'always-available' => false, |
|
| 1895 | 'translations' => array( |
|
| 1896 | 'cro-HR' => 'tri', |
|
| 1897 | 'eng-GB' => 'dva', |
|
| 1898 | ), |
|
| 1899 | ), |
|
| 1900 | ), |
|
| 1901 | 'languageCodes' => array( |
|
| 1902 | 'cro-HR', |
|
| 1903 | ), |
|
| 1904 | 'alwaysAvailable' => false, |
|
| 1905 | 'isHistory' => false, |
|
| 1906 | 'isCustom' => false, |
|
| 1907 | 'forward' => false, |
|
| 1908 | ) |
|
| 1909 | ), |
|
| 1910 | $urlAlias |
|
| 1911 | ); |
|
| 1912 | } |
|
| 1913 | ||
| 1914 | /** |
|
| 1915 | * Test for the publishUrlAliasForLocation() method. |
|
| @@ 1920-1978 (lines=59) @@ | ||
| 1917 | * @group cleanup |
|
| 1918 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation |
|
| 1919 | */ |
|
| 1920 | public function testPublishUrlAliasReuseAutogeneratedCleanup() |
|
| 1921 | { |
|
| 1922 | $handler = $this->getHandler(); |
|
| 1923 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_cleanup_reusing.php'); |
|
| 1924 | ||
| 1925 | $handler->publishUrlAliasForLocation(314, 2, 'dva', 'cro-HR', false); |
|
| 1926 | ||
| 1927 | $urlAlias = $handler->lookup('jedan'); |
|
| 1928 | $this->assertEquals( |
|
| 1929 | new UrlAlias( |
|
| 1930 | array( |
|
| 1931 | 'id' => '0-' . md5('jedan'), |
|
| 1932 | 'type' => UrlAlias::LOCATION, |
|
| 1933 | 'destination' => 314, |
|
| 1934 | 'pathData' => array( |
|
| 1935 | array( |
|
| 1936 | 'always-available' => false, |
|
| 1937 | 'translations' => array('cro-HR' => 'jedan'), |
|
| 1938 | ), |
|
| 1939 | ), |
|
| 1940 | 'languageCodes' => array('cro-HR'), |
|
| 1941 | 'alwaysAvailable' => false, |
|
| 1942 | 'isHistory' => true, |
|
| 1943 | 'isCustom' => false, |
|
| 1944 | 'forward' => false, |
|
| 1945 | ) |
|
| 1946 | ), |
|
| 1947 | $urlAlias |
|
| 1948 | ); |
|
| 1949 | ||
| 1950 | $urlAlias = $handler->lookup('dva'); |
|
| 1951 | $this->assertEquals( |
|
| 1952 | new UrlAlias( |
|
| 1953 | array( |
|
| 1954 | 'id' => '0-' . md5('dva'), |
|
| 1955 | 'type' => UrlAlias::LOCATION, |
|
| 1956 | 'destination' => 314, |
|
| 1957 | 'pathData' => array( |
|
| 1958 | array( |
|
| 1959 | 'always-available' => false, |
|
| 1960 | 'translations' => array( |
|
| 1961 | 'cro-HR' => 'dva', |
|
| 1962 | 'eng-GB' => 'dva', |
|
| 1963 | ), |
|
| 1964 | ), |
|
| 1965 | ), |
|
| 1966 | 'languageCodes' => array( |
|
| 1967 | 'cro-HR', |
|
| 1968 | 'eng-GB', |
|
| 1969 | ), |
|
| 1970 | 'alwaysAvailable' => false, |
|
| 1971 | 'isHistory' => false, |
|
| 1972 | 'isCustom' => false, |
|
| 1973 | 'forward' => false, |
|
| 1974 | ) |
|
| 1975 | ), |
|
| 1976 | $urlAlias |
|
| 1977 | ); |
|
| 1978 | } |
|
| 1979 | ||
| 1980 | /** |
|
| 1981 | * Test for the createCustomUrlAlias() method. |
|