Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation.

This commit is contained in:
Pantheon Automation 2015-11-17 13:42:33 -08:00 committed by Greg Anderson
parent 4afb23bbd3
commit 7784f4c23d
929 changed files with 19798 additions and 5304 deletions

View file

@ -0,0 +1,80 @@
<?php
/**
* @file
* Contains \Drupal\migrate_drupal\Tests\StubTestTrait.
*/
namespace Drupal\migrate_drupal\Tests;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate\Row;
/**
* Provides common functionality for testing stubbing.
*/
trait StubTestTrait {
/**
* Test that creating a stub of the given entity type results in a valid
* entity.
*
* @param string $entity_type_id
* The entity type we are stubbing.
*/
protected function performStubTest($entity_type_id) {
$entity_id = $this->createStub($entity_type_id);
$this->assertTrue($entity_id, 'Stub successfully created');
if ($entity_id) {
$violations = $this->validateStub($entity_type_id, $entity_id);
if (!$this->assertIdentical(count($violations), 0, 'Stub is a valid entity')) {
foreach ($violations as $violation) {
$this->fail((string) $violation->getMessage());
}
}
}
}
/**
* Create a stub of the given entity type.
*
* @param string $entity_type_id
* The entity type we are stubbing.
*
* @return int
* ID of the created entity.
*/
protected function createStub($entity_type_id) {
// Create a dummy migration to pass to the destination plugin.
$config = [
'id' => 'dummy',
'migration_tags' => ['Stub test'],
'source' => ['plugin' => 'empty'],
'process' => [],
'destination' => ['plugin' => 'entity:' . $entity_type_id],
];
$migration = Migration::create($config);
$destination_plugin = $migration->getDestinationPlugin(TRUE);
$stub_row = new Row([], [], TRUE);
$destination_ids = $destination_plugin->import($stub_row);
return reset($destination_ids);
}
/**
* Perform validation on a stub entity.
*
* @param string $entity_type_id
* The entity type we are stubbing.
* @param string $entity_id
* ID of the stubbed entity to validate.
*
* @return \Drupal\Core\Entity\EntityConstraintViolationListInterface
* List of constraint violations identified.
*/
protected function validateStub($entity_type_id, $entity_id) {
$controller = \Drupal::entityManager()->getStorage($entity_type_id);
/** @var \Drupal\Core\Entity\ContentEntityInterface $stub_entity */
$stub_entity = $controller->load($entity_id);
return $stub_entity->validate();
}
}

View file

@ -41539,10 +41539,30 @@ $connection->insert('variable')
'name' => 'tracker_batch_size',
'value' => 'i:999;',
))
->values(array(
'name' => 'update_check_frequency',
'value' => 'i:1;',
))
->values(array(
'name' => 'update_fetch_url',
'value' => 's:23:"http://127.0.0.1/update";',
))
->values(array(
'name' => 'update_last_check',
'value' => 'i:1444944973;',
))
->values(array(
'name' => 'update_max_fetch_attempts',
'value' => 'i:3;',
))
->values(array(
'name' => 'update_notification_threshold',
'value' => 's:3:"all";',
))
->values(array(
'name' => 'update_notify_emails',
'value' => 'a:1:{i:0;s:19:"webmaster@127.0.0.1";}',
))
->values(array(
'name' => 'user_admin_role',
'value' => 's:1:"3";',