Issue #2254777 by m1r1k: Block category autocomplete does not work.
parent
938ac1f5b7
commit
6c8d082611
|
@ -59,7 +59,7 @@ class CategoryAutocompleteController implements ContainerInjectionInterface {
|
|||
$matches = array();
|
||||
foreach ($this->blockManager->getCategories() as $category) {
|
||||
if (stripos($category, $typed_category) === 0) {
|
||||
$matches[$category] = String::checkPlain($category);
|
||||
$matches[] = array('value' => $category, 'label' => String::checkPlain($category));
|
||||
}
|
||||
}
|
||||
return new JsonResponse($matches);
|
||||
|
|
|
@ -59,8 +59,8 @@ class CategoryAutocompleteTest extends UnitTestCase {
|
|||
*/
|
||||
public function testAutocompleteSuggestions($string, $suggestions) {
|
||||
$suggestions = array_map(function ($suggestion) {
|
||||
return String::checkPlain($suggestion);
|
||||
}, array_combine($suggestions, $suggestions));
|
||||
return array('value' => $suggestion, 'label' => String::checkPlain($suggestion));
|
||||
}, $suggestions);
|
||||
$result = $this->autocompleteController->autocomplete(new Request(array('q' => $string)));
|
||||
$this->assertSame($suggestions, json_decode($result->getContent(), TRUE));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue