Update to Drupal 8.0.5. For more information, see https://www.drupal.org/node/2679347

This commit is contained in:
Pantheon Automation 2016-03-02 12:40:24 -08:00 committed by Greg Anderson
parent 2a9f1f148d
commit fd3b12cf27
251 changed files with 5439 additions and 957 deletions

View file

@ -9,6 +9,8 @@ namespace Drupal\node\Tests\Migrate\d6;
use Drupal\migrate\Entity\Migration;
use Drupal\Core\Database\Database;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\MigrateIdMapInterface;
use Drupal\node\Entity\Node;
/**
@ -24,9 +26,6 @@ class MigrateNodeTest extends MigrateNodeTestBase {
protected function setUp() {
parent::setUp();
$this->executeMigrations(['d6_node:*']);
// This is required for the second import below.
\Drupal::database()->truncate(Migration::load('d6_node__story')->getIdMap()->mapTableName())->execute();
}
/**
@ -53,27 +52,61 @@ class MigrateNodeTest extends MigrateNodeTestBase {
// This is empty on the first revision.
$this->assertIdentical(NULL, $node_revision->revision_log->value);
$node = Node::load(2);
$this->assertIdentical('Test title rev 3', $node->getTitle());
$this->assertIdentical('test rev 3', $node->body->value);
$this->assertIdentical('filtered_html', $node->body->format);
// Test that we can re-import using the EntityContentBase destination.
$connection = Database::getConnection('default', 'migrate');
$connection->update('node_revisions')
$title = $this->rerunMigration();
$node = Node::load(2);
$this->assertIdentical($title, $node->getTitle());
// Test multi-column fields are correctly upgraded.
$this->assertIdentical('test rev 3', $node->body->value);
$this->assertIdentical('full_html', $node->body->format);
// Now insert a row indicating a failure and set to update later.
$title = $this->rerunMigration(array(
'sourceid1' => 2,
'destid1' => NULL,
'source_row_status' => MigrateIdMapInterface::STATUS_NEEDS_UPDATE,
));
$node = Node::load(2);
$this->assertIdentical($title, $node->getTitle());
}
/**
* Execute the migration a second time.
*
* @param array $new_row
* An optional row to be inserted into the id map.
*
* @return string
* The new title in the source for vid 3.
*/
protected function rerunMigration($new_row = []) {
$title = $this->randomString();
$migration = Migration::load('d6_node__story');
$source_connection = Database::getConnection('default', 'migrate');
$source_connection->update('node_revisions')
->fields(array(
'title' => 'New node title',
'title' => $title,
'format' => 2,
))
->condition('vid', 1)
->condition('vid', 3)
->execute();
$connection->delete('content_field_test_two')
->condition('delta', 1)
->execute();
$migration = Migration::load('d6_node__story');
$table_name = $migration->getIdMap()->mapTableName();
$default_connection = \Drupal::database();
$default_connection->truncate($table_name)->execute();
if ($new_row) {
$hash = $migration->getIdMap()->getSourceIDsHash(['nid' => $new_row['sourceid1']]);
$new_row['source_ids_hash'] = $hash;
$default_connection->insert($table_name)
->fields($new_row)
->execute();
}
$this->executeMigration($migration);
$node = Node::load(1);
$this->assertIdentical('New node title', $node->getTitle());
// Test a multi-column fields are correctly upgraded.
$this->assertIdentical('test', $node->body->value);
$this->assertIdentical('full_html', $node->body->format);
return $title;
}
}

View file

@ -171,6 +171,22 @@ class NodeAccessBaseTableTest extends NodeTestBase {
// This user should be able to see all of the nodes on the relevant
// taxonomy pages.
$this->assertTaxonomyPage(TRUE);
// Rebuild the node access permissions, repeat the test. This is done to
// ensure that node access is rebuilt correctly even if the current user
// does not have the bypass node access permission.
node_access_rebuild();
foreach ($this->nodesByUser as $private_status) {
foreach ($private_status as $nid => $is_private) {
$this->drupalGet('node/' . $nid);
$this->assertResponse(200);
}
}
// This user should be able to see all of the nodes on the relevant
// taxonomy pages.
$this->assertTaxonomyPage(TRUE);
}
/**

View file

@ -0,0 +1,80 @@
<?php
/**
* @file
* Contains \Drupal\node\Tests\Views\RevisionCreateTimestampTest.
*/
namespace Drupal\node\Tests\Views;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\views\Tests\ViewKernelTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\views\Views;
/**
* Ensures that the revision create time can be accessed in views.
*
* @group views
*/
class RevisionCreateTimestampTest extends ViewKernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['node_test_views', 'node', 'views', 'user'];
/**
* {@inheritdoc}
*/
public static $testViews = ['test_node_revision_timestamp'];
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE) {
parent::setUp($import_test_views);
$this->installSchema('node', 'node_access');
$this->installEntitySchema('node');
$this->installEntitySchema('user');
if ($import_test_views) {
ViewTestData::createTestViews(get_class($this), ['node_test_views']);
}
}
public function testRevisionCreateTimestampView() {
$node_type = NodeType::create([
'type' => 'article',
'label' => 'Article',
]);
$node_type->save();
$node = Node::create([
'title' => 'Test node',
'type' => 'article',
'revision_timestamp' => 1000,
]);
$node->save();
$node->setRevisionCreationTime(1200);
$node->setNewRevision(TRUE);
$node->save();
$node->setRevisionCreationTime(1400);
$node->setNewRevision(TRUE);
$node->save();
$view = Views::getView('test_node_revision_timestamp');
$this->executeView($view);
$this->assertIdenticalResultset($view, [
['vid' => 3, 'revision_timestamp' => 1400],
['vid' => 2, 'revision_timestamp' => 1200],
['vid' => 1, 'revision_timestamp' => 1000],
], ['vid' => 'vid', 'revision_timestamp' => 'revision_timestamp']);
}
}