protected function NodeTest::setUp in Zircon Profile 8.0
Same name in this branch
- 8.0 core/modules/node/tests/src/Unit/Plugin/migrate/source/d6/NodeTest.php \Drupal\Tests\node\Unit\Plugin\migrate\source\d6\NodeTest::setUp()
- 8.0 core/modules/node/tests/src/Unit/Plugin/migrate/source/d7/NodeTest.php \Drupal\Tests\node\Unit\Plugin\migrate\source\d7\NodeTest::setUp()
Same name and namespace in other branches
- 8 core/modules/node/tests/src/Unit/Plugin/migrate/source/d7/NodeTest.php \Drupal\Tests\node\Unit\Plugin\migrate\source\d7\NodeTest::setUp()
Overrides MigrateSqlSourceTestCase::setUp
File
- core/
modules/ node/ tests/ src/ Unit/ Plugin/ migrate/ source/ d7/ NodeTest.php, line 91 - Contains \Drupal\Tests\node\Unit\Plugin\migrate\source\d7\NodeTest.
Class
- NodeTest
- Tests D7 node source plugin.
Namespace
Drupal\Tests\node\Unit\Plugin\migrate\source\d7Code
protected function setUp() {
foreach ($this->expectedResults as $k => $row) {
foreach (array(
'nid',
'vid',
'title',
'uid',
'timestamp',
'log',
) as $field) {
$this->databaseContents['node_revision'][$k][$field] = $row[$field];
switch ($field) {
case 'nid':
case 'vid':
break;
case 'uid':
$this->databaseContents['node_revision'][$k]['uid']++;
break;
default:
unset($row[$field]);
break;
}
}
$this->databaseContents['node'][$k] = $row;
}
array_walk($this->expectedResults, function (&$row) {
$row['node_uid'] = $row['uid'];
$row['revision_uid'] = $row['uid'] + 1;
unset($row['uid']);
});
$this->databaseContents['field_config_instance'] = array(
array(
'id' => '2',
'field_id' => '2',
'field_name' => 'body',
'entity_type' => 'node',
'bundle' => 'page',
'data' => 'a:0:{}',
'deleted' => '0',
),
array(
'id' => '2',
'field_id' => '2',
'field_name' => 'body',
'entity_type' => 'node',
'bundle' => 'article',
'data' => 'a:0:{}',
'deleted' => '0',
),
);
$this->databaseContents['field_revision_body'] = array(
array(
'entity_type' => 'node',
'bundle' => 'page',
'deleted' => '0',
'entity_id' => '1',
'revision_id' => '1',
'language' => 'en',
'delta' => '0',
'body_value' => 'Foobaz',
'body_summary' => '',
'body_format' => 'filtered_html',
),
);
parent::setUp();
}