Update to Drupal 8.0.6. For more information, see https://www.drupal.org/drupal-8.0.6-release-notes

This commit is contained in:
Pantheon Automation 2016-04-07 11:19:57 -07:00 committed by Greg Anderson
parent 4297c64508
commit b11a755ba8
159 changed files with 2340 additions and 543 deletions

View file

@ -107,16 +107,33 @@ class SqlBaseTest extends UnitTestCase {
FALSE,
TRUE,
TRUE,
['username' => 'different_from_map', 'password' => 'different_from_map'],
['username' => 'different_from_source', 'password' => 'different_from_source'],
['driver' => 'mysql', 'username' => 'different_from_map', 'password' => 'different_from_map'],
['driver' => 'mysql', 'username' => 'different_from_source', 'password' => 'different_from_source'],
],
// Returns true because source and id map connection options are the same.
[
TRUE,
TRUE,
TRUE,
['username' => 'same_value', 'password' => 'same_value'],
['username' => 'same_value', 'password' => 'same_value'],
['driver' => 'pgsql', 'username' => 'same_value', 'password' => 'same_value'],
['driver' => 'pgsql', 'username' => 'same_value', 'password' => 'same_value'],
],
// Returns false because driver is sqlite and the databases are not the
// same.
[
FALSE,
TRUE,
TRUE,
['driver' => 'sqlite', 'database' => '1.sqlite', 'username' => '', 'password' => ''],
['driver' => 'sqlite', 'database' => '2.sqlite', 'username' => '', 'password' => ''],
],
// Returns false because driver is not the same.
[
FALSE,
TRUE,
TRUE,
['driver' => 'pgsql', 'username' => 'same_value', 'password' => 'same_value'],
['driver' => 'mysql', 'username' => 'same_value', 'password' => 'same_value'],
],
];
}

View file

@ -49,9 +49,72 @@ class ConfigTest extends UnitTestCase {
->disableOriginalConstructor()
->getMock();
$row->expects($this->once())
->method('hasDestinationProperty')
->will($this->returnValue(FALSE));
$row->expects($this->any())
->method('getRawDestination')
->will($this->returnValue($source));
$destination = new Config(array('config_name' => 'd8_config'), 'd8_config', array('pluginId' => 'd8_config'), $migration, $config_factory);
$language_manager = $this->getMockBuilder('Drupal\language\ConfigurableLanguageManagerInterface')
->disableOriginalConstructor()
->getMock();
$language_manager->expects($this->never())
->method('getLanguageConfigOverride')
->with('fr', 'd8_config')
->will($this->returnValue($config));
$destination = new Config(array('config_name' => 'd8_config'), 'd8_config', array('pluginId' => 'd8_config'), $migration, $config_factory, $language_manager);
$destination_id = $destination->import($row);
$this->assertEquals($destination_id, ['d8_config']);
}
/**
* Test the import method.
*/
public function testLanguageImport() {
$source = array(
'langcode' => 'mi',
);
$migration = $this->getMockBuilder('Drupal\migrate\Entity\Migration')
->disableOriginalConstructor()
->getMock();
$config = $this->getMockBuilder('Drupal\Core\Config\Config')
->disableOriginalConstructor()
->getMock();
foreach ($source as $key => $val) {
$config->expects($this->once())
->method('set')
->with($this->equalTo($key), $this->equalTo($val))
->will($this->returnValue($config));
}
$config->expects($this->once())
->method('save');
$config->expects($this->any())
->method('getName')
->willReturn('d8_config');
$config_factory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
$config_factory->expects($this->once())
->method('getEditable')
->with('d8_config')
->will($this->returnValue($config));
$row = $this->getMockBuilder('Drupal\migrate\Row')
->disableOriginalConstructor()
->getMock();
$row->expects($this->once())
->method('hasDestinationProperty')
->will($this->returnValue($source));
$row->expects($this->any())
->method('getRawDestination')
->will($this->returnValue($source));
$row->expects($this->any())
->method('getDestinationProperty')
->will($this->returnValue($source['langcode']));
$language_manager = $this->getMockBuilder('Drupal\language\ConfigurableLanguageManagerInterface')
->disableOriginalConstructor()
->getMock();
$language_manager->expects($this->any())
->method('getLanguageConfigOverride')
->with('mi', 'd8_config')
->will($this->returnValue($config));
$destination = new Config(array('config_name' => 'd8_config'), 'd8_config', array('pluginId' => 'd8_config'), $migration, $config_factory, $language_manager);
$destination_id = $destination->import($row);
$this->assertEquals($destination_id, ['d8_config']);
}

View file

@ -82,6 +82,28 @@ class GetTest extends MigrateProcessTestCase {
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame($value, array('source_value1', 'source_value2', 'source_value3', 'source_value4'));
}
/**
* Tests the Get plugin when source has integer values.
*/
public function testIntegerValues() {
$this->row->expects($this->exactly(2))
->method('getSourceProperty')
->willReturnOnConsecutiveCalls('val1', 'val2');
$this->plugin->setSource([0 => 0, 1 => 'test']);
$return = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame([0 => 'val1', 1 => 'val2'], $return);
$this->plugin->setSource([FALSE]);
$return = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame([NULL], $return);
$this->plugin->setSource([NULL]);
$return = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertSame([NULL], $return);
}
}
namespace Drupal\migrate\Plugin\migrate\process;