You are here

class ParserIcalFeedsDateTestCase in iCal feed parser 7

Same name and namespace in other branches
  1. 6.2 tests/parser_ical_feeds.test \ParserIcalFeedsDateTestCase

Hierarchy

Expanded class hierarchy of ParserIcalFeedsDateTestCase

File

tests/parser_ical_feeds.test, line 132

View source
class ParserIcalFeedsDateTestCase extends ParserIcalFeedsTestCase {
  public static function getInfo() {
    return array(
      'name' => t('Basic feeds integration'),
      'description' => t('Test Feeds iCal parser support and date mapping. <strong>Requires Feeds and Date module.</strong>'),
      'group' => t('iCal Parser'),
    );
  }

  /**
   * Basic test using Basic.ics
   */
  public function testBasicFeed() {
    $typename = $this
      ->createConfiguredFeed();

    // Import iCal file.
    $this
      ->importFile('ical', $this
      ->absolutePath() . '/tests/feeds/Basic.ics');
    $this
      ->assertText('Created 7 ' . $typename . ' nodes.');

    // Check the imported nodes.
    // Timezones
    $data = array(
      array(
        'title' => 'Simple start and end',
        'field' => '2009-01-31 19:30',
        'site' => '2009-01-31 19:30',
        'field2' => '2009-01-31 20:30',
        'site2' => '2009-01-31 20:30',
        'timezone' => 'Pacific/Apia',
      ),
      array(
        'title' => 'Different start and end',
        'field' => '2009-01-01 19:00',
        'site' => '2009-01-01 07:00',
        'field2' => '2009-01-01 20:00',
        'site2' => '2009-01-01 08:00',
        'timezone' => 'Europe/Paris',
      ),
      array(
        'title' => 'No timezone this time',
        'field' => '2009-09-01 19:00',
        'site' => '2009-09-01 19:00',
        'field2' => '2009-09-01 20:00',
        'site2' => '2009-09-01 20:00',
        'timezone' => 'Pacific/Apia',
      ),
      array(
        'title' => 'UTC demarked with Z, over midnight.',
        'field' => '2009-09-30 19:00',
        'site' => '2009-09-30 08:00',
        'field2' => '2009-10-01 20:00',
        'site2' => '2009-10-01 09:00',
        'timezone' => 'UTC',
      ),
    );
    for ($i = 1; $i <= count($data); $i++) {
      $this
        ->drupalGet("node/{$i}/edit");
      $this
        ->pass('Checking : ' . $d['title']);
      $this
        ->assertNodeFieldValue('datefield', $d['field']);

      # ok how does this work then
      $this
        ->assertCCKFieldValue('datesite', $d['site']);
      $this
        ->assertCCKFieldValue2('datefield', $d['field2']);
      $this
        ->assertCCKFieldValue2('datesite', $d['site2']);
      $this
        ->assertCCKFieldTimezone('datefield', $d['timezone']);
    }

    // test if it refreshes items correctly
    $this
      ->importFile('ical', $this
      ->absolutePath() . '/tests/feeds/Basic1.ics');
    $this
      ->assertText('Updated 1 ' . $typename . ' node.');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ParserIcalFeedsDateTestCase::getInfo public static function
ParserIcalFeedsDateTestCase::testBasicFeed public function Basic test using Basic.ics
ParserIcalFeedsTestCase::absolutePath public function
ParserIcalFeedsTestCase::assertCCKFieldTimezone protected function
ParserIcalFeedsTestCase::assertCCKFieldValue2 protected function assertCCKFieldValue uses an XPath on the CCK fields on the form, the method looks in 'value' and for plain text the end date is a 'value2'
ParserIcalFeedsTestCase::createConfiguredFeed public function Basic test configured feed item, to import feed into. 1
ParserIcalFeedsTestCase::getFormFieldsNames protected function Return the form field name for a given CCK field. Special handling for date fields.
ParserIcalFeedsTestCase::setUp public function Set up the test. 1