You are here

public function CodeFilterPrismUnitTestCase::testCodeFilterPrismAttributes in Code Filter 7

Tests <code class="..."> tags (with attributes).

File

modules/codefilter_prism/codefilter_prism.test, line 124
Unit tests for codefilter_prism.module.

Class

CodeFilterPrismUnitTestCase
Contains unit tests for codefilter_prism.module.

Code

public function testCodeFilterPrismAttributes() {
  $input = <<<EOD
<code class="diff">
line1
line2
</code>
EOD;
  $expected = <<<EOD
<pre class="codeblock"><code class="language-php diff">line1&#10;line2&#10;</code></pre>
EOD;
  $result = $this
    ->filterText($input);
  $this
    ->assertIdentical($expected, $result);

  // Existing language.
  $input = <<<EOD
<pre class="codeblock"><code class="language-css">
line1
line2
</code></pre>
EOD;
  $expected = <<<EOD
<pre class="codeblock"><code class="language-css">line1
line2
</code></pre>
EOD;
  $result = $this
    ->filterText($input);
  $this
    ->assertIdentical($expected, $result);
}