function CurrencyLocalePatternCRUDWebTestCase::localePatternExists in Currency 7.2
Checks if a locale pattern exists in the database.
Parameters
CurrencyLocalePattern $locale_pattern:
Return value
boolean
1 call to CurrencyLocalePatternCRUDWebTestCase::localePatternExists()
- CurrencyLocalePatternCRUDWebTestCase::testCRUD in currency/
tests/ CurrencyLocalePatternCRUDWebTestCase.test - Test CRUD functionality.
File
- currency/
tests/ CurrencyLocalePatternCRUDWebTestCase.test, line 39 - Contains class CurrencyLocalePatternCRUDWebTestCase.
Class
- CurrencyLocalePatternCRUDWebTestCase
- Tests CRUD.
Code
function localePatternExists(CurrencyLocalePattern $locale_pattern) {
$schema = drupal_get_schema('currency_locale_pattern');
$query = db_select('currency_locale_pattern');
foreach (array_keys($schema['fields']) as $property) {
$query
->condition($property, $locale_pattern->{$property});
}
return $query
->countQuery()
->execute()
->fetchField();
}