Skip to content

Commit

Permalink
Merge branch '6.7' into 6.8
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Mar 21, 2017
2 parents 40828a9 + 739e8ba commit 34d5ab0
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
Expand Up @@ -9,6 +9,7 @@
namespace eZ\Publish\API\Repository\Tests\FieldType;

use eZ\Publish\Core\FieldType\Keyword\Value as KeywordValue;
use eZ\Publish\API\Repository\Values\ContentType\ContentType;
use eZ\Publish\API\Repository\Values\Content\Field;

/**
Expand Down Expand Up @@ -391,6 +392,49 @@ private function assertContentFieldHasCorrectData($contentId, KeywordValue $valu
$this->assertEquals($value, $dataField->value);
}

public function testKeywordsAreCaseSensitive()
{
$contentType = $this->testCreateContentType();
$publishedContent01 = $this->createAndPublishContent('Foo', $contentType, md5(uniqid() . microtime()));
$publishedContent02 = $this->createAndPublishContent('foo', $contentType, md5(uniqid() . microtime()));

$data = $publishedContent01->getField('data')->value;
$this->assertCount(1, $data->values);
$this->assertEquals('Foo', $data->values[0]);

$data = $publishedContent02->getField('data')->value;
$this->assertCount(1, $data->values);
$this->assertEquals('foo', $data->values[0]);
}

/**
* Create and publish content of $contentType with $fieldData.
*
* @param mixed $fieldData
* @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType
* @param string $remoteId
* @return \eZ\Publish\API\Repository\Values\Content\Content
*/
protected function createAndPublishContent($fieldData, ContentType $contentType, $remoteId)
{
$repository = $this->getRepository();
$contentService = $repository->getContentService();

$createStruct = $contentService->newContentCreateStruct($contentType, 'eng-US');
$createStruct->setField('name', 'Test object');
$createStruct->setField(
'data',
$fieldData
);

$createStruct->remoteId = $remoteId;
$createStruct->alwaysAvailable = true;

$contentDraft = $contentService->createContent($createStruct);

return $contentService->publishVersion($contentDraft->versionInfo);
}

protected function getValidSearchValueOne()
{
return 'add';
Expand Down
Expand Up @@ -225,6 +225,10 @@ protected function getExistingKeywords($keywordList, $contentTypeId)
$existingKeywordMap = array();

foreach ($statement->fetchAll(\PDO::FETCH_ASSOC) as $row) {
// filter out keywords that aren't the exact match (e.g. differ by case)
if (!in_array($row['keyword'], $keywordList)) {
continue;
}
$existingKeywordMap[$row['keyword']] = $row['id'];
}

Expand Down
Expand Up @@ -261,7 +261,7 @@ public function testToFieldDefinitionCurrentDate()
self::assertCount(3, $fieldDef->defaultValue->data);
self::assertNull($fieldDef->defaultValue->data['rfc850']);
self::assertGreaterThanOrEqual($time, $fieldDef->defaultValue->data['timestamp']);
self::assertEquals($time + 1, $dateTimeFromString->getTimestamp());
self::assertEquals($time + 1, $dateTimeFromString->getTimestamp(), 'Time does not match within 1s delta', 1);
}

/**
Expand Down

0 comments on commit 34d5ab0

Please sign in to comment.