Commit d2ec8a49 authored by alexpott's avatar alexpott

Issue #2807509 by phenaproxima, quietone: Convert Aggregator's Migrate source...

Issue #2807509 by phenaproxima, quietone: Convert Aggregator's Migrate source tests to new base class
parent 7f4e7eb6
<?php
namespace Drupal\Tests\aggregator\Kernel\Plugin\migrate\source;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
/**
* Tests D6 aggregator feed source plugin.
*
* @covers \Drupal\aggregator\Plugin\migrate\source\AggregatorFeed
* @group aggregator
*/
class AggregatorFeedTest extends MigrateSqlSourceTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['aggregator', 'migrate_drupal'];
/**
* {@inheritdoc}
*/
public function providerSource() {
$tests = [];
$tests[0]['database']['aggregator_feed'] = [
[
'fid' => 1,
'title' => 'feed title 1',
'url' => 'http://example.com/feed.rss',
'refresh' => 900,
'checked' => 0,
'link' => 'http://example.com',
'description' => 'A vague description',
'image' => '',
'etag' => '',
'modified' => 0,
'block' => 5,
],
[
'fid' => 2,
'title' => 'feed title 2',
'url' => 'http://example.net/news.rss',
'refresh' => 1800,
'checked' => 0,
'link' => 'http://example.net',
'description' => 'An even more vague description',
'image' => '',
'etag' => '',
'modified' => 0,
'block' => 5,
],
];
// The expected results are identical to the source data.
$tests[0]['expected_results'] = $tests[0]['database']['aggregator_feed'];
return $tests;
}
}
<?php
namespace Drupal\Tests\aggregator\Kernel\Plugin\migrate\source;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
/**
* Tests aggregator item source plugin.
*
* @covers \Drupal\aggregator\Plugin\migrate\source\AggregatorItem
* @group aggregator
*/
class AggregatorItemTest extends MigrateSqlSourceTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['aggregator', 'migrate_drupal'];
/**
* {@inheritdoc}
*/
public function providerSource() {
$tests = [];
$tests[0]['database']['aggregator_item'] = [
[
'iid' => 1,
'fid' => 1,
'title' => 'This (three) weeks in Drupal Core - January 10th 2014',
'link' => 'https://groups.drupal.org/node/395218',
'author' => 'larowlan',
'description' => "<h2 id='new'>What's new with Drupal 8?</h2>",
'timestamp' => 1389297196,
'guid' => '395218 at https://groups.drupal.org',
],
];
// The expected results are identical to the source data.
$tests[0]['expected_results'] = $tests[0]['database']['aggregator_item'];
return $tests;
}
}
<?php
namespace Drupal\Tests\aggregator\Unit\Plugin\migrate\source;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
/**
* Tests aggregator item source plugin.
*
* @group aggregator
*/
class AggregatorItemTest extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = 'Drupal\aggregator\Plugin\migrate\source\AggregatorItem';
protected $migrationConfiguration = array(
'id' => 'test',
'source' => array(
'plugin' => 'aggregator_item',
),
);
protected $expectedResults = array(
array(
'iid' => 1,
'fid' => 1,
'title' => 'This (three) weeks in Drupal Core - January 10th 2014',
'link' => 'https://groups.drupal.org/node/395218',
'author' => 'larowlan',
'description' => "<h2 id='new'>What's new with Drupal 8?</h2>",
'timestamp' => 1389297196,
'guid' => '395218 at https://groups.drupal.org',
),
);
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->databaseContents['aggregator_item'] = $this->expectedResults;
parent::setUp();
}
}
<?php
namespace Drupal\Tests\aggregator\Unit\Plugin\migrate\source\d6;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
/**
* Tests D6 aggregator feed source plugin.
*
* @group aggregator
*/
class AggregatorFeedTest extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = 'Drupal\aggregator\Plugin\migrate\source\AggregatorFeed';
protected $migrationConfiguration = array(
'id' => 'test',
'source' => array(
'plugin' => 'd6_aggregator_feed',
),
);
protected $expectedResults = array(
array(
'fid' => 1,
'title' => 'feed title 1',
'url' => 'http://example.com/feed.rss',
'refresh' => 900,
'checked' => 0,
'link' => 'http://example.com',
'description' => 'A vague description',
'image' => '',
'etag' => '',
'modified' => 0,
'block' => 5,
),
array(
'fid' => 2,
'title' => 'feed title 2',
'url' => 'http://example.net/news.rss',
'refresh' => 1800,
'checked' => 0,
'link' => 'http://example.net',
'description' => 'An even more vague description',
'image' => '',
'etag' => '',
'modified' => 0,
'block' => 5,
),
);
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->databaseContents['aggregator_feed'] = $this->expectedResults;
parent::setUp();
}
}
<?php
namespace Drupal\Tests\aggregator\Unit\Plugin\migrate\source\d7;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
/**
* Tests D7 aggregator feed source plugin.
*
* @group aggregator
*/
class AggregatorFeedTest extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = 'Drupal\aggregator\Plugin\migrate\source\AggregatorFeed';
protected $migrationConfiguration = array(
'id' => 'test',
'source' => array(
'plugin' => 'd7_aggregator_feed',
),
);
protected $expectedResults = array(
array(
'fid' => 1,
'title' => 'feed title 1',
'url' => 'http://example.com/feed.rss',
'refresh' => 900,
'checked' => 0,
'queued' => 0,
'link' => 'http://example.com',
'description' => 'A vague description',
'image' => '',
'etag' => '',
'modified' => 0,
'block' => 5,
),
array(
'fid' => 2,
'title' => 'feed title 2',
'url' => 'http://example.net/news.rss',
'refresh' => 1800,
'checked' => 0,
'queued' => 0,
'link' => 'http://example.net',
'description' => 'An even more vague description',
'image' => '',
'etag' => '',
'modified' => 0,
'block' => 5,
),
);
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->databaseContents['aggregator_feed'] = $this->expectedResults;
parent::setUp();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment