You are here

public function TokenUnitTestCase::testClearOption in Token 6

Test the $options['clear'] parameter for token_replace().

File

./token.test, line 174
Tests for the token module.

Class

TokenUnitTestCase

Code

public function testClearOption() {
  $tests[] = array(
    'input' => 'Foo [site-name][invalid-token] bar [another-invalid-token] [invalid-token]',
    'output' => 'Foo Drupal bar  ',
    'options' => array(
      'clear' => TRUE,
    ),
  );
  $tests[] = array(
    'input' => 'Foo [site-name][invalid-token] bar [another-invalid-token] [invalid-token]',
    'output' => 'Foo Drupal[invalid-token] bar [another-invalid-token] [invalid-token]',
    'options' => array(),
  );
  foreach ($tests as $test) {
    $output = token_replace($test['input'], 'global', NULL, TOKEN_PREFIX, TOKEN_SUFFIX, $test['options']);
    $this
      ->assertIdentical($output, $test['output']);
  }
}