Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-35364

Shorten text can cause invalid HTML

    Details

      Description

      Add this unit test to lib/tests/moodlelib_test.php.

          function test_shorten_text_multilang() {
              $text = '<span lang="en" class="multilang">A</span>' .
                      '<span lang="fr" class="multilang">B</span>';
              $this->assertEquals('<span lang="en" class="multilang">A</span>...', shorten_text($text, 1));
          }
      

      The actual result, right now, is '<span lang="en" ...</span>', so the test fails. Clearly, shorten_text should never return invalid HTML, so this test should pass.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/May/13