You are here

public function FeedsEntityProcessorDateTest::testEnableDateApiModuleAdvise in Feeds entity processor 7

Tests if the user is advised to enable the Date API module.

File

tests/src/FeedsEntityProcessorDateTest.test, line 156
Contains FeedsEntityProcessorDateTest.

Class

FeedsEntityProcessorDateTest
Tests importing entities with properties of various data types.

Code

public function testEnableDateApiModuleAdvise() {

  // Disable the Date API module first.
  module_disable(array(
    'date_api',
  ));

  // Go to the settings page.
  $this
    ->drupalGet('admin/structure/feeds/syndication/settings/FeedsEntityProcessorFeeds_entity_processor_test');

  // Assert advise about enabling the Date API module.
  $this
    ->assertText('Enter a timestamp or enable the Date API module');

  // Go to the mapping page.
  $this
    ->drupalGet('admin/structure/feeds/syndication/mapping');

  // Since there hasn't been mapped to a date target yet, assert that no
  // warning is yet shown about enabling the Date API module.
  $this
    ->assertNoText('Enable the Date API module');

  // Now map to a date target.
  $this
    ->addMappings('syndication', array(
    2 => array(
      'source' => 'created',
      'target' => 'created',
    ),
  ));

  // Assert that a warning now is shown.
  $this
    ->assertText('Enable the Date API module');

  // Now enable the Date API module again.
  module_enable(array(
    'date_api',
  ));

  // Assert that the advise about enabling the Date API module is now gone on
  // the settings page.
  $this
    ->drupalGet('admin/structure/feeds/syndication/settings/FeedsEntityProcessorFeeds_entity_processor_test');
  $this
    ->assertNoText('Enter a timestamp or enable the Date API module');

  // Assert that the warning on the mapping page is gone as well.
  $this
    ->drupalGet('admin/structure/feeds/syndication/mapping');
  $this
    ->assertNoText('Enable the Date API module');
}