You are here

public function FeedsContentTypeTest::testWithContentTypeWithoutTitle in Feeds 7.2

Tests that the feed node gets no title if the content type does not use the node title field.

File

tests/feeds_content_type.test, line 94
Contains FeedsContentTypeTest.

Class

FeedsContentTypeTest
Tests for when an importer is attached to a content type.

Code

public function testWithContentTypeWithoutTitle() {

  // Set that the content type 'page' has no title.
  db_update('node_type')
    ->fields(array(
    'has_title' => 0,
  ))
    ->condition('type', 'page')
    ->execute();

  // Flush caches so this change is picked up.
  drupal_flush_all_caches();

  // And import a RSS feed with a title.
  $edit = array(
    'feeds[FeedsHTTPFetcher][source]' => $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/developmentseed.rss2',
  );
  $this
    ->drupalPost('node/add/page', $edit, 'Save');

  // Assert that the feed node didn't got a title from the source.
  $node = node_load(1);
  $this
    ->assertEqual('', $node->title, 'The feed node has no title.');
}