You are here

function CurrencyCRUDWebTestCase::currencyExists in Currency 7.2

Checks if a currency exists in the database.

Parameters

Currency $currency:

Return value

boolean

1 call to CurrencyCRUDWebTestCase::currencyExists()
CurrencyCRUDWebTestCase::testCRUD in currency/tests/CurrencyCRUDWebTestCase.test
Test CRUD functionality.

File

currency/tests/CurrencyCRUDWebTestCase.test, line 39
Contains class CurrencyCRUDWebTestCase.

Class

CurrencyCRUDWebTestCase
Tests CRUD.

Code

function currencyExists(Currency $currency) {
  $schema = drupal_get_schema('currency');
  $query = db_select('currency');
  foreach (array_keys($schema['fields']) as $property) {
    $query
      ->condition($property, $currency->{$property});
  }
  return $query
    ->countQuery()
    ->execute()
    ->fetchField();
}