Skip to content

Commit

Permalink
Fix EZP-26344: Publishing URL alias does not always respect reserved …
Browse files Browse the repository at this point in the history
…names (#1784)
  • Loading branch information
pspanja committed Sep 21, 2016
1 parent 91afbbe commit 8197e67
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ public function publishUrlAliasForLocation(
$updatePathIdentificationString = false
) {
$parentId = $this->getRealAliasId($parentLocationId);
$uniqueCounter = $this->slugConverter->getUniqueCounterValue($name, $parentId == 0);
$name = $this->slugConverter->convert($name, 'location_' . $locationId);
$uniqueCounter = $this->slugConverter->getUniqueCounterValue($name, $parentId == 0);
$languageId = $this->languageHandler->loadByLanguageCode($languageCode)->id;
$languageMask = $languageId | (int)$alwaysAvailable;
$action = 'eznode:' . $locationId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3073,6 +3073,40 @@ public function testLoadUrlAliasThrowsNotFoundException()
$handler->loadUrlAlias('non-existent');
}

public function providerForTestPublishUrlAliasForLocationSkipsReservedWord()
{
return [
[
'section',
'section2',
],
[
'claß',
'class2',
],
];
}

/**
* Test for the publishUrlAliasForLocation() method.
*
* @dataProvider providerForTestPublishUrlAliasForLocationSkipsReservedWord
* @covers \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Handler::publishUrlAliasForLocation
* @group publish
*/
public function testPublishUrlAliasForLocationSkipsReservedWord($text, $alias)
{
$handler = $this->getHandler();
$this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php');

$handler->publishUrlAliasForLocation(314, 2, $text, 'kli-KR');

$urlAlias = $handler->lookup($alias);

$this->assertEquals(314, $urlAlias->destination);
$this->assertEquals(['kli-KR'], $urlAlias->languageCodes);
}

/**
* @return int
*/
Expand Down

0 comments on commit 8197e67

Please sign in to comment.