protected function AbstractAutocompleteSynonymsWebTestCase::assertAutocompleteMenuPath in Synonyms 7
Assert output of synonym friendly autocomplete path.
Parameters
string $input: String of input to supply to the autocomplete path
array $standard: Expected output from the autocomplete path. Supply it as an associative array
string $message: Drupal assertion message to be displayed on the rest results page
3 calls to AbstractAutocompleteSynonymsWebTestCase::assertAutocompleteMenuPath()
- AbstractAutocompleteSynonymsWebTestCase::testAutocompleteMenuPath in ./
synonyms.test - Test autocomplete menu path.
- AbstractAutocompleteSynonymsWebTestCase::testWidgetSettingsSuggestionSize in ./
synonyms.test - Test 'Suggestions Size' setting of synonyms-friendly autocomplete widget.
- AbstractAutocompleteSynonymsWebTestCase::testWidgetSettingsSuggestOnlyUnique in ./
synonyms.test - Test 'Suggest only one entry per term' setting of autocomplete widget.
File
- ./
synonyms.test, line 620 - Tests for the Synonyms module.
Class
- AbstractAutocompleteSynonymsWebTestCase
- Test "Synonyms friendly autocomplete" widget of Synonyms module.
Code
protected function assertAutocompleteMenuPath($input, $standard, $message) {
$response = $this
->drupalGet($this->reference_instance['widget']['settings']['synonyms_autocomplete_path'] . '/' . $this->reference_field['field_name'] . '/' . $this->entity_type . '/' . $this->bundle . '/' . $input);
if (!$response) {
$this
->fail($message, 'Autocomplete Menu Path');
return;
}
$response = (array) json_decode($response);
$is_the_same = count($response) == count($standard);
$is_the_same = $is_the_same && count(array_intersect_assoc($response, $standard)) == count($standard);
$this
->assertTrue($is_the_same, $message, 'Autocomplete Menu Path');
}