Commit 04fdb835 authored by alexpott's avatar alexpott
Browse files

Issue #2337749 by benjy: Fixed no_stub is never used.

parent f30b1265
......@@ -99,7 +99,8 @@ public function transform($value, MigrateExecutable $migrate_executable, Row $ro
break;
}
}
if (!$destination_ids && (($self && empty($this->configuration['no stub'])) || isset($this->configuration['stub_id']) || count($migrations) == 1)) {
if (!$destination_ids && ($self && empty($this->configuration['no_stub']) || isset($this->configuration['stub_id']) || count($migrations) == 1)) {
// If the lookup didn't succeed, figure out which migration will do the
// stubbing.
if ($self) {
......
......@@ -36,6 +36,7 @@ protected function setUp() {
$this->migrateExecutable = $this->getMockBuilder('Drupal\migrate\MigrateExecutable')
->disableOriginalConstructor()
->getMock();
parent::setUp();
}
......
<?php
/**
* @file
* Contains \Drupal\Tests\migrate\Unit\process\MigrationTest.
*/
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\migrate\Plugin\migrate\process\Migration;
/**
* Test the Migration process plugin.
*
* @coversDefaultClass \Drupal\migrate\Plugin\migrate\process\Migration
*
* @group migrate
*/
class MigrationTest extends MigrateProcessTestCase {
/**
* {@inheritdoc}
*/
public function setUp() {
$this->plugin = new TestMigrationTest();
$this->migrationConfiguration = array('id' => 'test_migration');
parent::setUp();
}
/**
* Test the no_stub setting.
*
* @covers ::transform
*
* @expectedException \Drupal\migrate\MigrateSkipRowException
*/
public function testNoStub() {
$migration = $this->getMigration();
$this->plugin->migration = $migration;
$storage = $this->getMock('Drupal\Core\Entity\EntityStorageInterface');
$storage->expects($this->any())
->method('loadMultiple')
->willReturn(array($migration, $migration));
$this->plugin->setMigrationStorage($storage);
$this->plugin->setConfiguration(array(
'migration' => array('test_migration', 'test_migration2'),
'no_stub' => TRUE,
));
$this->plugin->transform('test', $this->migrateExecutable, $this->row, 'test');
}
}
class TestMigrationTest extends Migration {
public function __construct() {
}
public function setConfiguration($configuration) {
$this->configuration = $configuration;
}
public function setMigrationStorage($storage) {
$this->migrationStorage = $storage;
}
}
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