You are here

public function FeedsTamperCovertBooleanTestCase::test in Feeds Tamper 7

Same name and namespace in other branches
  1. 6 tests/feeds_tamper_plugins.test \FeedsTamperCovertBooleanTestCase::test()

File

tests/feeds_tamper_plugins.test, line 163
Unit tests for feeds tamper plugins.

Class

FeedsTamperCovertBooleanTestCase
Tests for convert_boolean.inc

Code

public function test() {
  $settings = array(
    'true_value' => 'A',
    'false_value' => 'B',
    'match_case' => FALSE,
    'no_match' => 'false',
  );

  // Basic functionality.
  $this
    ->execute('A', TRUE, $settings);
  $this
    ->execute('B', FALSE, $settings);

  // match_case = FALSE works.
  $this
    ->execute('a', TRUE, $settings);
  $this
    ->execute('b', FALSE, $settings);

  // no_match = false
  $this
    ->execute('c', FALSE, $settings);
  $settings['no_match'] = 'pass';
  $this
    ->execute('c', 'c', $settings);

  // match_case = TRUE
  $settings['match_case'] = TRUE;
  $settings['no_match'] = 'false';
  $this
    ->execute('a', FALSE, $settings);

  // no_match = NULL.
  $settings['no_match'] = 'null';
  $this
    ->execute('a', NULL, $settings);

  // other_text = 'other text'.
  $settings['no_match'] = 'other';
  $settings['other_text'] = 'other text';
  $this
    ->execute('a', 'other text', $settings);
}