Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Model/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,8 @@ public function addExactMatchingMetadata(
public function getAllMetadata(): array
{
return array_merge(
$this->metadata,
$this->indexedMetadata
$this->indexedMetadata,
$this->metadata
);
}

Expand Down
16 changes: 16 additions & 0 deletions Tests/Model/ItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,22 @@ public function testIndexedMetadata()
$this->assertEquals(10, $item->getIndexedMetadata()['z']);
}

/**
* Test all metadata priorities.
*/
public function testAllMetadataPriorities()
{
$item = Item::createFromArray([
'uuid' => [
'id' => '1',
'type' => 'product',
],
'metadata' => ['a' => 'Hola'],
'indexed_metadata' => ['a' => 'hola'],
]);
$this->assertEquals('Hola', $item->getAllMetadata()['a']);
}

/**
* Test item to array with default values.
*/
Expand Down