You are here

public function ParserIcalFeedsDateTestCase::testBasicFeed in iCal feed parser 7

Same name and namespace in other branches
  1. 6.2 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',
    ),
  );
  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.');
}