Update core 8.3.0

This commit is contained in:
Rob Davies 2017-04-13 15:53:35 +01:00
parent da7a7918f8
commit cd7a898e66
6144 changed files with 132297 additions and 87747 deletions

View file

@ -0,0 +1,75 @@
<?php
namespace Drupal\Tests\tracker\Functional;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\BrowserTestBase;
/**
* Tests for private node access on /tracker.
*
* @group tracker
*/
class TrackerNodeAccessTest extends BrowserTestBase {
use CommentTestTrait;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['node', 'comment', 'tracker', 'node_access_test'];
protected function setUp() {
parent::setUp();
node_access_rebuild();
$this->drupalCreateContentType(['type' => 'page']);
node_access_test_add_field(NodeType::load('page'));
$this->addDefaultCommentField('node', 'page', 'comment', CommentItemInterface::OPEN);
\Drupal::state()->set('node_access_test.private', TRUE);
}
/**
* Ensure private node on /tracker is only visible to users with permission.
*/
public function testTrackerNodeAccess() {
// Create user with node test view permission.
$access_user = $this->drupalCreateUser(['node test view', 'access user profiles']);
// Create user without node test view permission.
$no_access_user = $this->drupalCreateUser(['access user profiles']);
$this->drupalLogin($access_user);
// Create some nodes.
$private_node = $this->drupalCreateNode([
'title' => t('Private node test'),
'private' => TRUE,
]);
$public_node = $this->drupalCreateNode([
'title' => t('Public node test'),
'private' => FALSE,
]);
// User with access should see both nodes created.
$this->drupalGet('activity');
$this->assertText($private_node->getTitle(), 'Private node is visible to user with private access.');
$this->assertText($public_node->getTitle(), 'Public node is visible to user with private access.');
$this->drupalGet('user/' . $access_user->id() . '/activity');
$this->assertText($private_node->getTitle(), 'Private node is visible to user with private access.');
$this->assertText($public_node->getTitle(), 'Public node is visible to user with private access.');
// User without access should not see private node.
$this->drupalLogin($no_access_user);
$this->drupalGet('activity');
$this->assertNoText($private_node->getTitle(), 'Private node is not visible to user without private access.');
$this->assertText($public_node->getTitle(), 'Public node is visible to user without private access.');
$this->drupalGet('user/' . $access_user->id() . '/activity');
$this->assertNoText($private_node->getTitle(), 'Private node is not visible to user without private access.');
$this->assertText($public_node->getTitle(), 'Public node is visible to user without private access.');
}
}

View file

@ -47,17 +47,17 @@ class MigrateTrackerNodeTest extends MigrateDrupal7TestBase {
public function testMigrateTrackerNode() {
$connection = Database::getConnection('default', 'migrate');
$num_rows = $connection
->select('tracker_node', 'tn')
->fields('tn', ['nid', 'published', 'changed'])
->countQuery()
->execute()
->fetchField();
->select('tracker_node', 'tn')
->fields('tn', ['nid', 'published', 'changed'])
->countQuery()
->execute()
->fetchField();
$this->assertIdentical('1', $num_rows);
$tracker_nodes = $connection
->select('tracker_node', 'tn')
->fields('tn', ['nid', 'published', 'changed'])
->execute();
->select('tracker_node', 'tn')
->fields('tn', ['nid', 'published', 'changed'])
->execute();
$row = $tracker_nodes->fetchAssoc();
$this->assertIdentical('1', $row['nid']);
$this->assertIdentical('1', $row['published']);

View file

@ -47,17 +47,17 @@ class MigrateTrackerUserTest extends MigrateDrupal7TestBase {
public function testMigrateTrackerUser() {
$connection = Database::getConnection('default', 'migrate');
$num_rows = $connection
->select('tracker_user', 'tn')
->fields('tu', ['nid', 'uid', 'published', 'changed'])
->countQuery()
->execute()
->fetchField();
->select('tracker_user', 'tn')
->fields('tu', ['nid', 'uid', 'published', 'changed'])
->countQuery()
->execute()
->fetchField();
$this->assertIdentical('1', $num_rows);
$tracker_nodes = $connection
->select('tracker_user', 'tu')
->fields('tu', ['nid', 'uid', 'published', 'changed'])
->execute();
->select('tracker_user', 'tu')
->fields('tu', ['nid', 'uid', 'published', 'changed'])
->execute();
$row = $tracker_nodes->fetchAssoc();
$this->assertIdentical('1', $row['nid']);
$this->assertIdentical('2', $row['uid']);