Projet

Général

Profil

Révision e4c061ad

Ajouté par Assos Assos il y a plus de 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/i18n/i18n_string/i18n_string.test
120 120
        $this->assertText($string_cache->data['string']);
121 121
      }
122 122
    }
123

  
124
    // Test that un-translated strings are cached correctly.
125
    $textgroup = 'test_cached';
126
    $key = 3;
127
    $string = self::randomName(100);
128
    $name = "$textgroup:item:$key:title";
129
    i18n_string_update($name, $string);
130

  
131
    // Generate the cache entry.
132
    $string_object = i18n_string_build($name, $string);
133
    $langcode = i18n_langcode();
134
    $string_object->get_translation($langcode);
135

  
136
    // Destroy the textgroup object to write the cache entry.
137
    $textgroup_object = i18n_string_textgroup($textgroup);
138
    $textgroup_object->__destruct();
139
    $this->assertTrue(cache_get($string_object->get_cid()) !== FALSE, "Cache entry created.");
140
    drupal_static_reset('i18n_string_textgroup');
141

  
142
    // Reset the loaded translation variable.
143
    variable_del('i18n_loaded_translations');
144
    $loaded_translations = variable_get('i18n_loaded_translations', array());
145
    $this->verbose(var_export($loaded_translations, TRUE));
146

  
147
    // Rebuild the string.
148
    $string_object = i18n_string_build($name, $string);
149
    $string_object->get_translation($langcode);
150

  
151
    // Check that the string hasn't been loaded.
152
    $loaded_translations = variable_get('i18n_loaded_translations', array());
153
    $this->verbose(var_export($loaded_translations, TRUE));
154
    $this->assertFalse(isset($loaded_translations['test_cached:item:3:title']), "The untranslated string was correctly cached.");
123 155
  }
124 156

  
125 157

  

Formats disponibles : Unified diff