Skip to content

Commit

Permalink
Merge branch '7.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Dec 13, 2018
2 parents 1200ea2 + 4cc037c commit 05264ee
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
12 changes: 6 additions & 6 deletions eZ/Publish/Core/FieldType/Tests/StringLengthValidatorTest.php
Expand Up @@ -217,14 +217,14 @@ public function providerForValidateKO()
return array(
array(
'',
'The string can not be shorter than %size% character.',
'The string can not be shorter than %size% characters.',
'The string cannot be shorter than %size% character.',
'The string cannot be shorter than %size% characters.',
array('%size%' => $this->getMinStringLength()),
),
array(
'Hi!',
'The string can not be shorter than %size% character.',
'The string can not be shorter than %size% characters.',
'The string cannot be shorter than %size% character.',
'The string cannot be shorter than %size% characters.',
array('%size%' => $this->getMinStringLength()),
),
array(
Expand All @@ -235,8 +235,8 @@ public function providerForValidateKO()
),
array(
'ABC♔',
'The string can not be shorter than %size% character.',
'The string can not be shorter than %size% characters.',
'The string cannot be shorter than %size% character.',
'The string cannot be shorter than %size% characters.',
array('%size%' => $this->getMinStringLength()),
),
);
Expand Down
12 changes: 6 additions & 6 deletions eZ/Publish/Core/FieldType/Tests/TextLineTest.php
Expand Up @@ -637,8 +637,8 @@ public function provideInvalidDataForValidate()
new TextLineValue('aaa'),
array(
new ValidationError(
'The string can not be shorter than %size% character.',
'The string can not be shorter than %size% characters.',
'The string cannot be shorter than %size% character.',
'The string cannot be shorter than %size% characters.',
array(
'%size%' => 5,
),
Expand Down Expand Up @@ -687,8 +687,8 @@ public function provideInvalidDataForValidate()
'text'
),
new ValidationError(
'The string can not be shorter than %size% character.',
'The string can not be shorter than %size% characters.',
'The string cannot be shorter than %size% character.',
'The string cannot be shorter than %size% characters.',
array(
'%size%' => 10,
),
Expand All @@ -708,8 +708,8 @@ public function provideInvalidDataForValidate()
new TextLineValue('ABC♔'),
array(
new ValidationError(
'The string can not be shorter than %size% character.',
'The string can not be shorter than %size% characters.',
'The string cannot be shorter than %size% character.',
'The string cannot be shorter than %size% characters.',
array(
'%size%' => 5,
),
Expand Down
4 changes: 2 additions & 2 deletions eZ/Publish/Core/FieldType/TextLine/Type.php
Expand Up @@ -107,8 +107,8 @@ public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue)
$constraints['minStringLength'] !== 0 &&
mb_strlen($fieldValue->text) < $constraints['minStringLength']) {
$validationErrors[] = new ValidationError(
'The string can not be shorter than %size% character.',
'The string can not be shorter than %size% characters.',
'The string cannot be shorter than %size% character.',
'The string cannot be shorter than %size% characters.',
array(
'%size%' => $constraints['minStringLength'],
),
Expand Down
4 changes: 2 additions & 2 deletions eZ/Publish/Core/FieldType/Validator/StringLengthValidator.php
Expand Up @@ -126,8 +126,8 @@ public function validate(BaseValue $value)
$this->constraints['minStringLength'] !== 0 &&
mb_strlen($value->text) < $this->constraints['minStringLength']) {
$this->errors[] = new ValidationError(
'The string can not be shorter than %size% character.',
'The string can not be shorter than %size% characters.',
'The string cannot be shorter than %size% character.',
'The string cannot be shorter than %size% characters.',
array(
'%size%' => $this->constraints['minStringLength'],
)
Expand Down
Expand Up @@ -114,7 +114,7 @@ public function doGenerate($location, array $parameters)
if ($rootLocationId !== null) {
$pathPrefix = $this->getPathPrefixByRootLocationId($rootLocationId, $languages, $siteaccess);
// "/" cannot be considered as a path prefix since it's root, so we ignore it.
if ($pathPrefix !== '/' && mb_stripos($path, $pathPrefix) === 0) {
if ($pathPrefix !== '/' && ($path === $pathPrefix || mb_stripos($path, $pathPrefix . '/') === 0)) {
$path = mb_substr($path, mb_strlen($pathPrefix));
} elseif ($pathPrefix !== '/' && !$this->isUriPrefixExcluded($path) && $this->logger !== null) {
// Location path is outside configured content tree and doesn't have an excluded prefix.
Expand Down
Expand Up @@ -427,6 +427,12 @@ public function providerTestDoGenerateRootLocation()
'/shared/some-content',
'/my/root-folder',
),
array(
new UrlAlias(array('path' => '/products/ez-publish')),
false,
'/products/ez-publish',
'/prod',
),
);
}

Expand Down

0 comments on commit 05264ee

Please sign in to comment.