You are here

function i18nTaxonomyTestCase::testTaxonomyFieldCallback in Internationalization 7

Tests the implementation of 'options_list_callback' for term reference fields. Enable and disable the callback properly. Avoid WSOD!

File

i18n_taxonomy/i18n_taxonomy.test, line 149
Test case for multilingual taxonomy

Class

i18nTaxonomyTestCase
@file Test case for multilingual taxonomy

Code

function testTaxonomyFieldCallback() {
  $field_name = 'taxonomy_term_test_field';
  $field = field_create_field(array(
    'field_name' => $field_name,
    'type' => 'taxonomy_term_reference',
  ));
  $field = field_info_field($field_name);
  $callback = 'i18n_taxonomy_allowed_values';
  $this
    ->assertTrue(function_exists($callback), "Function {$callback} exists.");
  $this
    ->assertEqual($field['settings']['options_list_callback'], $callback, "{$callback} ist option list callback.");
  module_disable(array(
    'i18n_taxonomy',
  ));
  $field = field_info_field($field_name);
  $this
    ->assertNotEqual($field['settings']['options_list_callback'], $callback, "{$callback} ist option list callback.");
}