This commit is contained in:
2025-03-21 20:24:43 +01:00
parent 224398df90
commit f34c9162d4
12427 changed files with 5329941 additions and 373384 deletions

View File

@@ -44,7 +44,7 @@ class URLSerializerTest extends MockeryTestCase
$facet->shouldReceive('getProperty')
->andReturnUsing(
function ($arg) use ($properties) {
return $properties[$arg];
return isset($properties[$arg]) ? $properties[$arg] : null;
}
);
@@ -67,7 +67,7 @@ class URLSerializerTest extends MockeryTestCase
$filter->shouldReceive('getProperty')
->andReturnUsing(
function ($arg) use ($properties) {
return $properties[$arg];
return isset($properties[$arg]) ? $properties[$arg] : null;
}
);
@@ -197,4 +197,43 @@ class URLSerializerTest extends MockeryTestCase
$facetsFilters
);
}
/**
* @dataProvider getSerializerData
*/
public function testSerializeUnserialize($expected, array $fragment)
{
$this->assertEquals($expected, $this->serializer->serialize($fragment));
$this->assertEquals($fragment, $this->serializer->unserialize($expected));
}
public function getSerializerData()
{
return [
[
'a-b',
['a' => ['b']],
],
[
'a-b-c',
['a' => ['b', 'c']],
],
[
'a-b-c/x-y-z',
['a' => ['b', 'c'], 'x' => ['y', 'z']],
],
[
'a-b\-c',
['a' => ['b-c']],
],
[
'Category-Men \/ Women \ \-Children-Clothes/Size-\-1-2',
['Category' => ['Men / Women \ -Children', 'Clothes'], 'Size' => ['-1', '2']],
],
[
'Category-\-\-\--\-2/\-Size\--\-1-\-2\-',
['Category' => ['---', '-2'], '-Size-' => ['-1', '-2-']],
],
];
}
}