a8c9b2c02c9301315cfa64232acd56ec81aa7034
[yaffs-website] / web / modules / contrib / typogrify / tests / typogrify-smartypants.test
1 <?php
2
3 class Filter {}
4
5 /**
6  * @file
7  * Unit tests for the basic typogrify functionality.
8  */
9 class TypogrifySmartyPantsTestCase extends DrupalWebTestCase {
10   /**
11    * Implements getInfo().
12    */
13   function getInfo() {
14     return array(
15       'name' => t('Typogrify with SmartyPants'),
16       'description' => t('Test the application of the full package of Typogrify and SmartyPants.'),
17       'group' => t('Typogrify'),
18     );
19   }
20
21   /**
22    * Implement setUp().
23    */
24   function setUp() {
25     parent::setUp('typogrify');
26     global $filter;
27     $filter = (object) array(
28       'settings' => array(
29       'smartypants_enabled' => 1,
30       'smartypants_hyphens' => 2,
31       'wrap_ampersand' => 1,
32       'widont_enabled' => 1,
33       'wrap_abbr' => 0,
34       'wrap_caps' => 1,
35       'wrap_initial_quotes' => 1,
36       'hyphenate_shy' => 0,
37       'wrap_numbers' => 0,
38       'ligatures' => array(),
39       'arrows' => array(),
40       'quotes' => array(),
41     )
42   );
43
44   }
45
46   /**
47    * Original example compatibility-test.
48    */
49   function testOriginalTypogrifyExample() {
50
51     $before = <<<HTML
52 <h2>"Jayhawks" & KU fans act extremely obnoxiously</h2>
53 <p>By J.D. Salinger, Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "Excepteur sint occaecat 'cupidatat' non proident" sunt RFID22 in.... </p>
54 HTML;
55     $after = <<<HTML
56 <h2>“Jayhawks” <span class="amp">&amp;</span> <span class="caps">KU</span> fans act extremely&nbsp;obnoxiously</h2>
57 <p>By <span class="caps">J.D.</span> Salinger, Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. “Excepteur sint occaecat ‘cupidatat’ non proident” sunt <span class="caps">RFID22</span>&nbsp;in&#8230;. </p>
58 HTML;
59
60     global $filter;
61     $result = _typogrify_process($before, $filter, NULL, 'en', NULL, NULL);
62     $this->assertEqual($result, $after, t('Original Typogrify example.'));
63
64   }
65 }