You are here

public function Mandrill_MessagesTest::search in Mandrill 7.2

See also

Mandrill_Messages::search()

File

tests/includes/mandrill_messages_test.inc, line 86
A virtual Mandrill Messages API implementation for use in testing.

Class

Mandrill_MessagesTest
@file A virtual Mandrill Messages API implementation for use in testing.

Code

public function search($query = '*', $date_from = NULL, $date_to = NULL, $tags = NULL, $senders = NULL, $api_keys = NULL, $limit = 100) {
  $matched_messages = array();
  $query_parts = explode(':', $query);
  $query_key = $query_parts[0];
  $query_value = $query_parts[1];
  $messages = $this
    ->getTestMessagesData();
  foreach ($messages as $message) {
    if (isset($message[$query_key]) && $message[$query_key] == $query_value) {
      $matched_messages[] = $message;
    }
  }
  return $matched_messages;
}