View source
<?php
namespace Drupal\Tests\comment\Unit\Migrate\d6;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
abstract class CommentTestBase extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = 'Drupal\\comment\\Plugin\\migrate\\source\\d6\\Comment';
protected $migrationConfiguration = array(
'id' => 'test',
'source' => array(
'plugin' => 'd6_comment',
),
);
protected $expectedResults = array(
array(
'cid' => 1,
'pid' => 0,
'nid' => 2,
'uid' => 3,
'subject' => 'subject value 1',
'comment' => 'comment value 1',
'hostname' => 'hostname value 1',
'timestamp' => 1382255613,
'status' => 1,
'thread' => '',
'name' => '',
'mail' => '',
'homepage' => '',
'format' => 'testformat1',
'type' => 'story',
),
array(
'cid' => 2,
'pid' => 1,
'nid' => 3,
'uid' => 4,
'subject' => 'subject value 2',
'comment' => 'comment value 2',
'hostname' => 'hostname value 2',
'timestamp' => 1382255662,
'status' => 1,
'thread' => '',
'name' => '',
'mail' => '',
'homepage' => '',
'format' => 'testformat2',
'type' => 'page',
),
);
protected function setUp() {
foreach ($this->expectedResults as $k => $row) {
$this->databaseContents['comments'][$k] = $row;
$this->databaseContents['comments'][$k]['status'] = 1 - $this->databaseContents['comments'][$k]['status'];
}
$this->databaseContents['node'][] = array(
'nid' => 2,
'type' => 'story',
);
$this->databaseContents['node'][] = array(
'nid' => 3,
'type' => 'page',
);
parent::setUp();
}
}