public function FeedsEntityProcessorPropertyTest::test in Feeds entity processor 7
Test basic entity creation.
File
- tests/
src/ FeedsEntityProcessorPropertyTest.test, line 63 - Contains FeedsEntityProcessorPropertyTest.
Class
- FeedsEntityProcessorPropertyTest
- Tests importing entities with properties of various data types.
Code
public function test() {
// Set bundle and set default values for required properties.
$this
->setSettings('syndication', 'FeedsEntityProcessorFeeds_entity_processor_test', array(
'bundle' => $this->bundle,
'values[entity][entity_type]' => 'node',
'values[entity][entity_id]' => $this->node->nid,
'values[user]' => 1,
));
$this
->addMappings('syndication', array(
0 => array(
'source' => 'guid',
'target' => 'guid',
'unique' => TRUE,
),
1 => array(
'source' => 'title',
'target' => 'title',
),
2 => array(
'source' => 'status',
'target' => 'status',
),
3 => array(
'source' => 'uid',
'target' => 'user',
),
4 => array(
'source' => 'nid',
'target' => 'entity',
),
5 => array(
'source' => 'created',
'target' => 'created',
),
));
// 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('Lorem Ipsum', $entity->title);
$this
->assertEqual($this->bundle, $entity->type);
$this
->assertEqual(1, $entity->status);
$this
->assertEqual(2, $entity->uid);
$this
->assertEqual(1, $entity->etid);
$this
->assertEqual('node', $entity->entity_type);
$this
->assertEqual(1454172758, $entity->created);
}