function TypogrifyClassTestCase::testAmpersandWrapping in Typogrify 6
Same name and namespace in other branches
- 7 tests/typogrify.class.test \TypogrifyClassTestCase::testAmpersandWrapping()
File
- tests/
typogrify.class.test, line 28 - typogrify.class.test Unit tests for the basic typogrify functionality.
Class
- TypogrifyClassTestCase
- @file typogrify.class.test Unit tests for the basic typogrify functionality.
Code
function testAmpersandWrapping() {
$before = 'John & Robert.';
$after = 'John <span class="amp">&</span> Robert.';
$this
->assertEqual(Typogrify::amp($before), $after, t('Basic ampersand wrapping'));
$before = 'P&T';
$after = 'P&T';
$this
->assertEqual(Typogrify::amp($before), $after, t("Don't mess with ampersands in words"));
$before = 'advanced robotics & computing...';
$after = 'advanced robotics <span class="amp">&</span> computing...';
$this
->assertEqual(Typogrify::amp($before), $after, t("One space as HTML entitiy."));
$before = 'advanced robotics & computing...';
$after = 'advanced robotics <span class="amp">&</span> computing...';
$this
->assertEqual(Typogrify::amp($before), $after, t("Ampersand as HTML entitiy."));
$before = 'advanced robotics & computing...';
$after = 'advanced robotics <span class="amp">&</span> computing...';
$this
->assertEqual(Typogrify::amp($before), $after, t("Both spaces and ampersand as HTML entities."));
$before = 'P&T had many clients, of which DD&T & Cronhammar, Kronhammer & Hjort were the largest';
$after = 'P&T had many clients, of which DD&T <span class="amp">&</span> Cronhammar, Kronhammer <span class="amp">&</span> Hjort were the largest';
$this
->assertEqual(Typogrify::amp($before), $after, t("Both spaces and ampersand as HTML entities."));
}