0da76240daad6179681163b6ca6eb2df3bc55beb
[yaffs-website] / web / modules / contrib / typogrify / src / Tests / TypogrifySmartyPantsTestCase.php
1 <?php
2
3 namespace Drupal\typogrify;
4
5 class TypogrifySmartyPantsTestCase extends DrupalWebTestCase {
6   /**
7    * Implements getInfo().
8    */
9   public function getInfo() {
10     return array(
11       'name' => t('Typogrify with SmartyPants'),
12       'description' => t('Test the application of the full package of Typogrify and SmartyPants.'),
13       'group' => t('Typogrify'),
14     );
15   }
16
17   /**
18    * Implement setUp().
19    */
20   public function setUp() {
21     parent::setUp('typogrify');
22     global $filter;
23     $filter = (object) array(
24       'settings' => array(
25       'smartypants_enabled' => 1,
26       'smartypants_hyphens' => 2,
27       'wrap_ampersand' => 1,
28       'widont_enabled' => 1,
29       'wrap_abbr' => 0,
30       'wrap_caps' => 1,
31       'wrap_initial_quotes' => 1,
32       'hyphenate_shy' => 0,
33       'wrap_numbers' => 0,
34       'ligatures' => array(),
35       'arrows' => array(),
36       'quotes' => array(),
37     ),
38   );
39
40   }
41
42   /**
43    * Original example compatibility-test.
44    */
45   public function testOriginalTypogrifyExample() {
46
47     $before = <<<HTML
48 <h2>"Jayhawks" & KU fans act extremely obnoxiously</h2>
49 <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>
50 HTML;
51     $after = <<<HTML
52 <h2>“Jayhawks” <span class="amp">&amp;</span> <span class="caps">KU</span> fans act extremely&nbsp;obnoxiously</h2>
53 <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>
54 HTML;
55
56     global $filter;
57     $result = _typogrify_process($before, $filter, NULL, 'en', NULL, NULL);
58     $this->assertEqual($result, $after, t('Original Typogrify example.'));
59
60   }
61 }