t('typogrify.class basic tests'), 'description' => t('Testing all methods on the Typogrify class and their interaction.'), 'group' => t('Typogrify'), ); } /** * Implements setUp(). */ function setUp() { parent::setUp('typogrify'); } /** * Tests ampersand-wrapping. */ function testAmpersandWrapping() { $before = 'John & Robert.'; $after = 'John & 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 & computing...'; $this->assertEqual(Typogrify::amp($before), $after, t("One space as HTML entitiy.")); $before = 'advanced robotics & computing...'; $after = 'advanced robotics & computing...'; $this->assertEqual(Typogrify::amp($before), $after, t("Ampersand as HTML entitiy.")); $before = 'advanced robotics & computing...'; $after = 'advanced robotics & 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 & Cronhammar, Kronhammer & Hjort were the largest'; $this->assertEqual(Typogrify::amp($before), $after, t("Both spaces and ampersand as HTML entities.")); } /** * Widont test. */ function testWidont() { $before = 'A very simple test'; $after = 'A very simple test'; $this->assertEqual(Typogrify::widont($before), $after, t('Basic widont. Once sentance, no HTML.')); // Single word items shouldn't be changed. $before = 'Test'; $after = 'Test'; $this->assertEqual(Typogrify::widont($before), $after, t('Single word test #1')); $before = ' Test'; $after = ' Test'; $this->assertEqual(Typogrify::widont($before), $after, t('Single word test #2')); $before = '