You are here

public function ParserIcalFeedsDateTestCase::testBasicFeed in iCal feed parser 6.2

Same name and namespace in other branches
  1. 7 tests/parser_ical_feeds.test \ParserIcalFeedsDateTestCase::testBasicFeed()

Basic test using Basic.ics

File

tests/parser_ical_feeds.test, line 144

Class

ParserIcalFeedsDateTestCase

Code

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',
    ),
  );
  foreach ($data as $d) {
    $n = node_load(array(
      'title' => $d['title'],
    ), NULL, TRUE);
    $this
      ->drupalGet('node/' . $n->nid . '/edit');
    $this
      ->pass('Checking : ' . $d['title']);
    $this
      ->assertCCKFieldValue('datefield', $d['field']);
    $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.');
}