Code Duplication    Length = 40-40 lines in 2 locations

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

@@ 2000-2039 (lines=40) @@
1997
     * @group create
1998
     * @group custom
1999
     */
2000
    public function testCreateCustomUrlAliasReusesHistory()
2001
    {
2002
        $handler = $this->getHandler();
2003
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2004
2005
        $countBeforeReusing = $this->countRows();
2006
        $handler->createCustomUrlAlias(
2007
            314,
2008
            'history-hello',
2009
            true,
2010
            'eng-GB',
2011
            true
2012
        );
2013
2014
        self::assertEquals(
2015
            $countBeforeReusing,
2016
            $this->countRows()
2017
        );
2018
        self::assertEquals(
2019
            new UrlAlias(
2020
                array(
2021
                    'id' => '0-da94285592c46d4396d3ca6904a4aa8f',
2022
                    'type' => UrlAlias::LOCATION,
2023
                    'destination' => 314,
2024
                    'languageCodes' => array('eng-GB'),
2025
                    'pathData' => array(
2026
                        array(
2027
                            'always-available' => true,
2028
                            'translations' => array('eng-GB' => 'history-hello'),
2029
                        ),
2030
                    ),
2031
                    'alwaysAvailable' => true,
2032
                    'isHistory' => false,
2033
                    'isCustom' => true,
2034
                    'forward' => true,
2035
                )
2036
            ),
2037
            $handler->lookup('history-hello')
2038
        );
2039
    }
2040
2041
    /**
2042
     * Test for the createUrlAlias() method.
@@ 2048-2087 (lines=40) @@
2045
     * @group create
2046
     * @group custom
2047
     */
2048
    public function testCreateCustomUrlAliasReusesHistoryOfDifferentLanguage()
2049
    {
2050
        $handler = $this->getHandler();
2051
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2052
2053
        $countBeforeReusing = $this->countRows();
2054
        $handler->createCustomUrlAlias(
2055
            314,
2056
            'history-hello',
2057
            true,
2058
            'cro-HR',
2059
            true
2060
        );
2061
2062
        self::assertEquals(
2063
            $countBeforeReusing,
2064
            $this->countRows()
2065
        );
2066
        self::assertEquals(
2067
            new UrlAlias(
2068
                array(
2069
                    'id' => '0-da94285592c46d4396d3ca6904a4aa8f',
2070
                    'type' => UrlAlias::LOCATION,
2071
                    'destination' => 314,
2072
                    'languageCodes' => array('cro-HR'),
2073
                    'pathData' => array(
2074
                        array(
2075
                            'always-available' => true,
2076
                            'translations' => array('cro-HR' => 'history-hello'),
2077
                        ),
2078
                    ),
2079
                    'alwaysAvailable' => true,
2080
                    'isHistory' => false,
2081
                    'isCustom' => true,
2082
                    'forward' => true,
2083
                )
2084
            ),
2085
            $handler->lookup('history-hello')
2086
        );
2087
    }
2088
2089
    /**
2090
     * Test for the createUrlAlias() method.