You are here

public function FeedsTamperExplodeTestCase::test in Feeds Tamper 6

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

File

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

Class

FeedsTamperExplodeTestCase
Tests for explode.inc

Code

public function test() {
  $settings = array(
    'separator' => ',',
    'limit' => NULL,
  );
  $this
    ->execute('a,b,c,d', array(
    'a',
    'b',
    'c',
    'd',
  ), $settings);
  $this
    ->execute('1,2,3,4', array(
    '1',
    '2',
    '3',
    '4',
  ), $settings);
  $this
    ->execute('123,1.23,abc,456 ,789,def890', array(
    '123',
    '1.23',
    'abc',
    '456 ',
    '789',
    'def890',
  ), $settings);
  $settings['limit'] = 2;
  $this
    ->execute('a,b,c,d', array(
    'a',
    'b,c,d',
  ), $settings);
  $this
    ->execute('a.b.c.d', array(
    'a.b.c.d',
  ), $settings);

  // Test multiple value handling.
  $settings['limit'] = NULL;
  $this
    ->execute(array(
    'a,b,c,d',
    'e,f,g,h',
  ), array(
    'a',
    'b',
    'c',
    'd',
    'e',
    'f',
    'g',
    'h',
  ), $settings);
  $this
    ->execute(array(
    'abcd',
    'e,f,g,h',
  ), array(
    'abcd',
    'e',
    'f',
    'g',
    'h',
  ), $settings);

  // Test negative values.

  //$settings['limit'] = 2;

  //$this->execute('a,b,c,d', array('a', 'b,c,d'), $settings);

  //$this->execute('a.b.c.d', array('a.b.c.d'), $settings);
}