You are here

function GeshiFilterTest::assertGeshiFilterHighlighting in GeSHi Filter for syntax highlighting 5.2

Same name and namespace in other branches
  1. 6 geshifilter.test \GeshiFilterTest::assertGeshiFilterHighlighting()
  2. 7 geshifilter.test \GeshiFilterTest::assertGeshiFilterHighlighting()

Assert function for testing if GeSHi highlighting works

2 calls to GeshiFilterTest::assertGeshiFilterHighlighting()
GeshiFilterTest::testPrefixTags in tests/geshifilter.test
Test if tags like [cpp], [css], [csharp] aren't highjacked by [c]
GeshiFilterTest::testSpecialTags in tests/geshifilter.test
Check if tags like [c++] and [c#] work Problem described in http://drupal.org/node/208720

File

tests/geshifilter.test, line 112

Class

GeshiFilterTest
Unit tests for the GeSHi filter module.

Code

function assertGeshiFilterHighlighting($open_tag, $source_code, $close_tag, $lang, $description) {

  // Create content.
  $edit = array(
    'title' => $this
      ->randomName(32, 'pagetitle_'),
    'body' => $open_tag . $source_code . $close_tag,
    'format' => $this->input_format_id,
  );
  $this
    ->drupalPostRequest('node/add/page', $edit, t('Submit'));

  // check posted node
  $node = node_load(array(
    'title' => $edit['title'],
  ));
  $this
    ->assertTrue($node, 'Node found in database. %s');

  // check if highlighting succeeded
  $highlighted = geshifilter_geshi_process($source_code, $lang);
  $this
    ->assertWantedRaw($highlighted, $description);
}