Update to Drupal 8.0.2. For more information, see https://www.drupal.org/drupal-8.0.2-release-notes
This commit is contained in:
parent
1a0e9d9fac
commit
a6b049dd05
538 changed files with 5247 additions and 1594 deletions
|
@ -124,7 +124,7 @@ function field_test_field_widget_form_alter(&$element, FormStateInterface $form_
|
|||
function field_test_query_efq_table_prefixing_test_alter(&$query) {
|
||||
// Add an additional join onto the entity base table. This will cause an
|
||||
// exception if the EFQ does not properly prefix the base table.
|
||||
$query->join('entity_test','et2','%alias.id = entity_test.id');
|
||||
$query->join('entity_test', 'et2', '%alias.id = entity_test.id');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\field\Unit\Plugin\migrate\process\d6\FieldTypeDefaultsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\field\Unit\Plugin\migrate\process\d6;
|
||||
|
||||
use Drupal\field\Plugin\migrate\process\d6\FieldTypeDefaults;
|
||||
use Drupal\migrate\MigrateException;
|
||||
use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;
|
||||
|
||||
/**
|
||||
* Tests D6 fields defaults.
|
||||
*
|
||||
* @coversDefaultClass \Drupal\field\Plugin\migrate\process\d6\FieldTypeDefaults
|
||||
* @group field
|
||||
*/
|
||||
class FieldTypeDefaultsTest extends MigrateProcessTestCase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->plugin = new FieldTypeDefaults([], 'field_type_defaults', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests various default cases.
|
||||
*
|
||||
* @covers ::transform
|
||||
*/
|
||||
public function testDefaults() {
|
||||
$this->row->expects($this->once())
|
||||
->method('getSourceProperty')
|
||||
->willReturn('date');
|
||||
|
||||
// Assert common values are passed through without modification.
|
||||
$this->assertNull($this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'property'));
|
||||
$this->assertEquals('string', $this->plugin->transform('string', $this->migrateExecutable, $this->row, 'property'));
|
||||
$this->assertEquals(1234, $this->plugin->transform(1234, $this->migrateExecutable, $this->row, 'property'));
|
||||
// Assert that an array checks that this is a date field(above mock assert)
|
||||
// and returns "datetime_default".
|
||||
$this->assertEquals('datetime_default', $this->plugin->transform([], $this->migrateExecutable, $this->row, 'property'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests an exception is thrown when the input is not a date field.
|
||||
*
|
||||
* @covers ::transform
|
||||
*/
|
||||
public function testDefaultsException() {
|
||||
$this->setExpectedException(MigrateException::class,
|
||||
sprintf('Failed to lookup field type %s in the static map.', var_export([], TRUE)));
|
||||
$this->plugin->transform([], $this->migrateExecutable, $this->row, 'property');
|
||||
}
|
||||
}
|
Reference in a new issue