eZ\Publish\Core\Persistence\Legacy\Tests\Content\UrlAliasHandlerTest::testLocationSwappedWithReusingNopEntryCustomAliasIsDestroyed PHP Method

testLocationSwappedWithReusingNopEntryCustomAliasIsDestroyed() public method

Test for the locationSwapped() method.
    public function testLocationSwappedWithReusingNopEntryCustomAliasIsDestroyed()
    {
        $handler = $this->getHandler();
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_reusing_nop.php');
        $handler->lookup('jedan/swap-that/search');
        $handler->locationSwapped(316, 314, 317, 315);
        try {
            $handler->lookup('jedan/swap-that/search');
            $this->fail('Custom alias is not destroyed');
        } catch (NotFoundException $e) {
            // Custom alias is destroyed by reusing NOP entry with existing autogenerated alias
            // on the same level (that means link and ID are updated to the existing alias ID,
            // so custom alias children entries are no longer properly linked (parent-link))
        }
    }
UrlAliasHandlerTest