<?php
require_once 'PHPUnit/Framework.php';

class ShortCodeTexturizing extends PHPUnit_Framework_TestCase
{
  public function testShortcodesAreNotTexturized()
  {
    require_once('./wp-includes/formatting.php');
    require_once('./wp-includes/plugin.php');
    require_once('./wp-includes/shortcodes.php');

    add_shortcode('shortcode', 'print_r');
    add_shortcode('shortcode_2', 'print_r');
    add_shortcode('shortcode_3', 'print_r');

    $format = <<<EOS
1 {y}

[shortcode]
2 {n}
[/shortcode]

3 {y}

Escape shortcode like this: [[shortcode_2]]

[shortcode_2]

4 {n}
[/shortcode_2][not a shortcode]

5 {y}[shortcode]
6 {n}[/shortcode]7 {y}

[not a shortcode]

[shortcode_2 standalone /][[shortcode_2]]

8 {y}

[shortcode_3 with_content]
9 {n}
[/shortcode_3]

[shortcode_3 standalone]
10 {y}

EOS;

    $search = array('{y}', '{n}');

    $yes = '"This" text -- should be \'texturized\'';
    $no = '"This" text -- should NOT be \'texturized\'';
    $replace = array($yes, $no);
    $input = str_replace($search, $replace, $format);

    $yes = '&#8220;This&#8221; text &#8212; should be &#8216;texturized&#8217;';
    $replace = array($yes, $no);
    $expected = str_replace($search, $replace, $format);

    $result = wptexturize($input);
    $this->assertEquals($expected, $result);
  }
}
?>