You are here

abstract class ParserIcalLocationTestCase in iCal feed parser 7.2

Common class for testing ical parsers link and guid mapping.

Hierarchy

Expanded class hierarchy of ParserIcalLocationTestCase

File

tests/parser_ical_location.test, line 11
Test case for CCK ical date field text mapper.

View source
abstract class ParserIcalLocationTestCase extends ParserIcalFeedsTestCase {

  /**
     * Set up the test.
     *
    public function setUp() {
      // @todo additional location modules to test
      parent::setUp();
    }*/

  /**
   * Basic test on simple ical file.
   */
  function testLocation() {

    // Create content type.
    $typename = $this
      ->createContentType(array(), array(
      'alpha' => 'text',
    ));
    $this
      ->createImporterConfiguration('iCal importer', 'ical');
    $this
      ->setSettings('ical', NULL, array(
      'content_type' => '',
      'import_period' => FEEDS_SCHEDULE_NEVER,
    ));
    $this
      ->setPlugin('ical', 'FeedsFileFetcher');
    $this
      ->setSettings('ical', 'FeedsFileFetcher', array(
      'allowed_extensions' => 'ics ical',
    ));
    $this
      ->configureParser();
    $this
      ->setSettings('ical', 'FeedsNodeProcessor', array(
      'content_type' => $typename,
    ));
    $this
      ->addMappings('ical', array(
      array(
        'source' => 'uid',
        'target' => 'guid',
      ),
      array(
        'source' => 'summary',
        'target' => 'title',
      ),
      array(
        'source' => 'location',
        'target' => 'field_alpha',
      ),
    ));

    // Import iCal file
    $this
      ->importFile('ical', $this
      ->absolutePath() . '/tests/feeds/location.ics');
    $this
      ->assertText('Created 3 nodes');
    $this
      ->locationAssertions();
  }

  /**
   * Correct assertions. This is overridden in the (date api) test,
   * as it's slightly broken.
   */
  function locationAssertions() {
    $this
      ->drupalGet('node/1/edit');
    $this
      ->assertFieldByName('field_alpha[und][0][value]', 'Conference Room - F123, Bldg. 002', 'Feed item 1 location text correct.');
    $this
      ->drupalGet('node/2/edit');
    $this
      ->assertFieldByName('field_alpha[und][0][value]', 'Conference Room - F123, Bldg. 002', 'Feed item 2 location text correct.');
    $this
      ->drupalGet('node/3/edit');
    $this
      ->assertFieldByName('field_alpha[und][0][value]', 'Regardz Meeting Center Eenhoorn @ Koningin Wilhelminalaan 33, Amersfoort, Utrecht 3818 HN', 'Feed item 3 location text correct.');
  }

  /**
   * Set and configure the parser plugin.
   */
  abstract function configureParser();

}

Members

Namesort descending Modifiers Type Description Overrides
ParserIcalFeedsTestCase::absolutePath public function
ParserIcalFeedsTestCase::setUp public function Set up the test. 2
ParserIcalLocationTestCase::configureParser abstract function Set and configure the parser plugin. 2
ParserIcalLocationTestCase::locationAssertions function Correct assertions. This is overridden in the (date api) test, as it's slightly broken. 1
ParserIcalLocationTestCase::testLocation function Basic test on simple ical file.