[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/tests/phpunit/testcases/ -> test_template_helper_functions.php (source)

   1  <?php
   2  
   3  // As the test cases don't load the GP front end, we need to include the helper-functions here to make them available.
   4  require_once GP_TMPL_PATH . 'helper-functions.php';
   5  
   6  class GP_Test_Template_Helper_Functions extends GP_UnitTestCase {
   7  
   8      function test_map_glossary_entries_to_translation_originals_with_ampersand_in_glossary() {
   9          $test_string = 'This string, <code>&lt;/body&gt;</code>, should not have the code tags mangled.';
  10          $orig = '';
  11          $expected_result = 'This string, &lt;code&gt;&amp;lt;/body<span class="glossary-word" data-translations="[{&quot;translation&quot;:&quot;&amp;amp;&quot;,&quot;pos&quot;:&quot;interjection&quot;,&quot;comment&quot;:null,&quot;locale_entry&quot;:&quot;&quot;}]">&amp;</span>gt;&lt;/code&gt;, should not have the code tags mangled.';
  12  
  13          $entry = new Translation_Entry( array( 'singular' => $test_string, ) );
  14  
  15          $set = $this->factory->translation_set->create_with_project_and_locale();
  16          $glossary = GP::$glossary->create_and_select( array( 'translation_set_id' => $set->id ) );
  17  
  18          $glossary_entry = array(
  19              'term' => '&',
  20              'part_of_speech' => 'interjection',
  21              'translation' => '&amp;',
  22              'glossary_id' => $glossary->id,
  23          );
  24  
  25          GP::$glossary_entry->create_and_select( $glossary_entry );
  26  
  27          $orig = map_glossary_entries_to_translation_originals( $entry, $glossary );
  28  
  29          $this->assertEquals( $orig->singular_glossary_markup, $expected_result );
  30      }
  31  
  32  }


Generated: Tue Nov 12 01:01:58 2019 Cross-referenced by PHPXref 0.7.1