You are here

protected function SynonymsProviderPropertyWebTestCase::assertSynonymsFind in Synonyms 7

Supportive assert method.

Assert results of synonymsFind() method.

Parameters

QueryConditionInterface $condition: Query condition to be passed on into synonymsFind() method

array $standard: Expected result

string $message: Optional additional assert message

1 call to SynonymsProviderPropertyWebTestCase::assertSynonymsFind()
SynonymsProviderPropertyWebTestCase::testProperty in synonyms_provider_property/synonyms_provider_property.test
Test property-based synonyms provider.

File

synonyms_provider_property/synonyms_provider_property.test, line 94
Test cases for Property synonyms provider module.

Class

SynonymsProviderPropertyWebTestCase
Test PropertySynonymsBehavior class.

Code

protected function assertSynonymsFind(QueryConditionInterface $condition, $standard, $message = '') {
  $map_standard = array();
  foreach ($standard as $v) {
    $map_standard[$v['entity_id']] = $v['synonym'];
  }
  $message = $this->behavior_implementation['class'] . '::synonymsFind() ' . $message;
  $result = $this->behavior_implementation['object']
    ->synonymsFind($condition);
  $count = 0;
  foreach ($result as $row) {
    $count++;
    if (!isset($map_standard[$row->entity_id]) || $map_standard[$row->entity_id] != $row->synonym) {
      $this
        ->fail($message);
      return;
    }
  }
  $this
    ->assertEqual(count($map_standard), $count, $message);
}