public function FeedsEntityProcessorPropertyTest::testWithoutDefaultValues in Feeds entity processor 7
Tests without setting default value data type "entity".
File
- tests/
src/ FeedsEntityProcessorPropertyTest.test, line 159 - Contains FeedsEntityProcessorPropertyTest.
Class
- FeedsEntityProcessorPropertyTest
- Tests importing entities with properties of various data types.
Code
public function testWithoutDefaultValues() {
// Make all properties of feeds_entity_processor_test entities non-required.
variable_set('feeds_entity_processor_test_required', FALSE);
// Make sure that entity info is reset.
drupal_flush_all_caches();
drupal_static_reset();
// Set bundle and set default values for required properties.
$this
->setSettings('syndication', 'FeedsEntityProcessorFeeds_entity_processor_test', array(
'bundle' => $this->bundle,
));
$this
->addMappings('syndication', array(
0 => array(
'source' => 'guid',
'target' => 'guid',
'unique' => TRUE,
),
1 => array(
'source' => 'uid',
'target' => 'user',
),
2 => array(
'source' => 'nid',
'target' => 'entity',
'entity_type' => 'node',
),
));
// Run import.
$this
->importURL('syndication', $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds_entity_processor') . '/tests/resources/test_content.csv');
$this
->assertText('Created 1 test entity');
// Check values of imported entity.
$entity = entity_load_single('feeds_entity_processor_test', 1);
$this
->assertEqual(2, $entity->uid);
$this
->assertEqual(1, $entity->etid);
$this
->assertEqual('node', $entity->entity_type);
}