update
This commit is contained in:
@@ -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-']],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user