Loading tests/FIlter/AggsTest.php +237 −6 Original line number Diff line number Diff line Loading @@ -178,8 +178,8 @@ class AggsTest extends TestCase 0 => [ 'label' => null, 'value' => 'red', 'count' => 0, 'active' => false 'count' => 1, 'active' => true ], 1 => [ 'label' => null, Loading Loading @@ -405,8 +405,8 @@ class AggsTest extends TestCase 0 => [ 'label' => null, 'value' => 'red', 'count' => 0, 'active' => false 'count' => 1, 'active' => true ], 1 => [ 'label' => null, Loading Loading @@ -526,8 +526,8 @@ class AggsTest extends TestCase 1 => [ 'label' => null, 'value' => 'white', 'count' => 0, 'active' => false 'count' => 1, 'active' => true ] ], 'range' => [] Loading Loading @@ -583,4 +583,235 @@ class AggsTest extends TestCase $this->assertEqualsCanonicalizing($expected, FormatData::formatDataWFacets($result)); } public function testKeywordFilter() { $handler = SearchClient::getInstance(); $q = SearchQuery::createFromArray( [ 'filters' => [ 'categoryId' => 't-short', 'color' => ['white'], 'brand' => ['nike'], 'price' => ['min' => 100] ] ] ); $result = $handler->handle($q); $expected = [ 'hits' => [ 'h2' ], 'facets' => [ 0 => [ 'code' => 'brand', 'label' => null, 'type' => 'list', 'items' => [ 'list' => [ 0 => [ 'label' => null, 'value' => 'nike', 'count' => 1, 'active' => true ], 1 => [ 'label' => null, 'value' => 'rebook', 'count' => 1, 'active' => true ] ], 'range' => [] ] ], 1 => [ 'code' => 'color', 'label' => null, 'type' => 'list', 'items' => [ 'list' => [ 0 => [ 'label' => null, 'value' => 'red', 'count' => 1, 'active' => true ], 1 => [ 'label' => null, 'value' => 'white', 'count' => 1, 'active' => true ] ], 'range' => [] ] ], 2 => [ 'code' => 'size', 'label' => null, 'type' => 'list', 'items' => [ 'list' => [ 0 => [ 'label' => null, 'value' => 'xl', 'count' => 0, 'active' => false ], 1 => [ 'label' => null, 'value' => 'xxl', 'count' => 1, 'active' => true ] ], 'range' => [] ] ], 3 => [ 'code' => 'price', 'label' => null, 'type' => 'range', 'items' => [ 'list' => [], 'range' => [ 0 => [ 'label' => null, 'count' => 1, 'active' => true, 'fullRange' => [ 'min' => 104.0, 'max' => 106.0 ], 'activeRange' => [ 'min' => 105.0, 'max' => 105.0 ] ] ] ] ] ] ]; $this->assertEqualsCanonicalizing($expected, FormatData::formatDataWFacets($result)); } public function testKeywordFilterTwo() { $handler = SearchClient::getInstance(); $q = SearchQuery::createFromArray( [ 'filters' => [ 'categoryId' => 't-short', 'color' => ['white'], 'brand' => ['nike', 'reebok'] ] ] ); $result = $handler->handle($q); $expected = [ 'hits' => [ 'h2' ], 'facets' => [ 0 => [ 'code' => 'brand', 'label' => null, 'type' => 'list', 'items' => [ 'list' => [ 0 => [ 'label' => null, 'value' => 'nike', 'count' => 1, 'active' => true ], 1 => [ 'label' => null, 'value' => 'rebook', 'count' => 1, 'active' => true ] ], 'range' => [] ] ], 1 => [ 'code' => 'color', 'label' => null, 'type' => 'list', 'items' => [ 'list' => [ 0 => [ 'label' => null, 'value' => 'red', 'count' => 1, 'active' => true ], 1 => [ 'label' => null, 'value' => 'white', 'count' => 1, 'active' => true ] ], 'range' => [] ] ], 2 => [ 'code' => 'size', 'label' => null, 'type' => 'list', 'items' => [ 'list' => [ 0 => [ 'label' => null, 'value' => 'xl', 'count' => 0, 'active' => false ], 1 => [ 'label' => null, 'value' => 'xxl', 'count' => 1, 'active' => true ] ], 'range' => [] ] ], 3 => [ 'code' => 'price', 'label' => null, 'type' => 'range', 'items' => [ 'list' => [], 'range' => [ 0 => [ 'label' => null, 'count' => 1, 'active' => true, 'fullRange' => [ 'min' => 104.0, 'max' => 106.0 ], 'activeRange' => [ 'min' => 105.0, 'max' => 105.0 ] ] ] ] ] ] ]; $this->assertEqualsCanonicalizing($expected, FormatData::formatDataWFacets($result)); } } No newline at end of file Loading
tests/FIlter/AggsTest.php +237 −6 Original line number Diff line number Diff line Loading @@ -178,8 +178,8 @@ class AggsTest extends TestCase 0 => [ 'label' => null, 'value' => 'red', 'count' => 0, 'active' => false 'count' => 1, 'active' => true ], 1 => [ 'label' => null, Loading Loading @@ -405,8 +405,8 @@ class AggsTest extends TestCase 0 => [ 'label' => null, 'value' => 'red', 'count' => 0, 'active' => false 'count' => 1, 'active' => true ], 1 => [ 'label' => null, Loading Loading @@ -526,8 +526,8 @@ class AggsTest extends TestCase 1 => [ 'label' => null, 'value' => 'white', 'count' => 0, 'active' => false 'count' => 1, 'active' => true ] ], 'range' => [] Loading Loading @@ -583,4 +583,235 @@ class AggsTest extends TestCase $this->assertEqualsCanonicalizing($expected, FormatData::formatDataWFacets($result)); } public function testKeywordFilter() { $handler = SearchClient::getInstance(); $q = SearchQuery::createFromArray( [ 'filters' => [ 'categoryId' => 't-short', 'color' => ['white'], 'brand' => ['nike'], 'price' => ['min' => 100] ] ] ); $result = $handler->handle($q); $expected = [ 'hits' => [ 'h2' ], 'facets' => [ 0 => [ 'code' => 'brand', 'label' => null, 'type' => 'list', 'items' => [ 'list' => [ 0 => [ 'label' => null, 'value' => 'nike', 'count' => 1, 'active' => true ], 1 => [ 'label' => null, 'value' => 'rebook', 'count' => 1, 'active' => true ] ], 'range' => [] ] ], 1 => [ 'code' => 'color', 'label' => null, 'type' => 'list', 'items' => [ 'list' => [ 0 => [ 'label' => null, 'value' => 'red', 'count' => 1, 'active' => true ], 1 => [ 'label' => null, 'value' => 'white', 'count' => 1, 'active' => true ] ], 'range' => [] ] ], 2 => [ 'code' => 'size', 'label' => null, 'type' => 'list', 'items' => [ 'list' => [ 0 => [ 'label' => null, 'value' => 'xl', 'count' => 0, 'active' => false ], 1 => [ 'label' => null, 'value' => 'xxl', 'count' => 1, 'active' => true ] ], 'range' => [] ] ], 3 => [ 'code' => 'price', 'label' => null, 'type' => 'range', 'items' => [ 'list' => [], 'range' => [ 0 => [ 'label' => null, 'count' => 1, 'active' => true, 'fullRange' => [ 'min' => 104.0, 'max' => 106.0 ], 'activeRange' => [ 'min' => 105.0, 'max' => 105.0 ] ] ] ] ] ] ]; $this->assertEqualsCanonicalizing($expected, FormatData::formatDataWFacets($result)); } public function testKeywordFilterTwo() { $handler = SearchClient::getInstance(); $q = SearchQuery::createFromArray( [ 'filters' => [ 'categoryId' => 't-short', 'color' => ['white'], 'brand' => ['nike', 'reebok'] ] ] ); $result = $handler->handle($q); $expected = [ 'hits' => [ 'h2' ], 'facets' => [ 0 => [ 'code' => 'brand', 'label' => null, 'type' => 'list', 'items' => [ 'list' => [ 0 => [ 'label' => null, 'value' => 'nike', 'count' => 1, 'active' => true ], 1 => [ 'label' => null, 'value' => 'rebook', 'count' => 1, 'active' => true ] ], 'range' => [] ] ], 1 => [ 'code' => 'color', 'label' => null, 'type' => 'list', 'items' => [ 'list' => [ 0 => [ 'label' => null, 'value' => 'red', 'count' => 1, 'active' => true ], 1 => [ 'label' => null, 'value' => 'white', 'count' => 1, 'active' => true ] ], 'range' => [] ] ], 2 => [ 'code' => 'size', 'label' => null, 'type' => 'list', 'items' => [ 'list' => [ 0 => [ 'label' => null, 'value' => 'xl', 'count' => 0, 'active' => false ], 1 => [ 'label' => null, 'value' => 'xxl', 'count' => 1, 'active' => true ] ], 'range' => [] ] ], 3 => [ 'code' => 'price', 'label' => null, 'type' => 'range', 'items' => [ 'list' => [], 'range' => [ 0 => [ 'label' => null, 'count' => 1, 'active' => true, 'fullRange' => [ 'min' => 104.0, 'max' => 106.0 ], 'activeRange' => [ 'min' => 105.0, 'max' => 105.0 ] ] ] ] ] ] ]; $this->assertEqualsCanonicalizing($expected, FormatData::formatDataWFacets($result)); } } No newline at end of file