updated core and modules

This commit is contained in:
Bachir Soussi Chiadmi
2017-09-09 16:27:51 +02:00
parent 027aa99b32
commit 41863f872c
7810 changed files with 318922 additions and 83631 deletions
@@ -2,7 +2,9 @@
namespace Drupal\tracker\Controller;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Session\AccountInterface;
use Drupal\user\UserInterface;
/**
@@ -18,4 +20,20 @@ class TrackerUserRecent extends ControllerBase {
return tracker_page($user);
}
/**
* Checks access for the users recent content tracker page.
*
* @param \Drupal\user\UserInterface $user
* The user being viewed.
* @param \Drupal\Core\Session\AccountInterface $account
* The account viewing the page.
*
* @return \Drupal\Core\Access\AccessResult
* The access result.
*/
public function checkAccess(UserInterface $user, AccountInterface $account) {
return AccessResult::allowedIf($account->isAuthenticated() && $user->id() == $account->id())
->cachePerUser();
}
}
@@ -37,7 +37,7 @@ class UserTrackerTab extends LocalTaskDefault {
* {@inheritdoc}
*/
public function getRouteParameters(RouteMatchInterface $route_match) {
return array('user' => $this->currentUser()->Id());
return ['user' => $this->currentUser()->Id()];
}
}
@@ -20,7 +20,7 @@ abstract class TrackerTestBase extends ViewTestBase {
*
* @var array
*/
public static $modules = array('comment', 'tracker', 'tracker_test_views');
public static $modules = ['comment', 'tracker', 'tracker_test_views'];
/**
* The node used for testing.
@@ -39,30 +39,30 @@ abstract class TrackerTestBase extends ViewTestBase {
protected function setUp() {
parent::setUp();
ViewTestData::createTestViews(get_class($this), array('tracker_test_views'));
ViewTestData::createTestViews(get_class($this), ['tracker_test_views']);
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
// Add a comment field.
$this->addDefaultCommentField('node', 'page');
$permissions = array('access comments', 'create page content', 'post comments', 'skip comment approval');
$permissions = ['access comments', 'create page content', 'post comments', 'skip comment approval'];
$account = $this->drupalCreateUser($permissions);
$this->drupalLogin($account);
$this->node = $this->drupalCreateNode(array(
$this->node = $this->drupalCreateNode([
'title' => $this->randomMachineName(8),
'uid' => $account->id(),
'status' => 1,
));
]);
$this->comment = Comment::create(array(
$this->comment = Comment::create([
'entity_id' => $this->node->id(),
'entity_type' => 'node',
'field_name' => 'comment',
'subject' => $this->randomMachineName(),
'comment_body[' . LanguageInterface::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomMachineName(20),
));
]);
}
@@ -16,29 +16,29 @@ class TrackerUserUidTest extends TrackerTestBase {
*
* @var array
*/
public static $testViews = array('test_tracker_user_uid');
public static $testViews = ['test_tracker_user_uid'];
/**
* Tests the user uid filter and argument.
*/
public function testUserUid() {
$map = array(
$map = [
'nid' => 'nid',
'title' => 'title',
);
];
$expected = array(
array(
$expected = [
[
'nid' => $this->node->id(),
'title' => $this->node->label(),
)
);
]
];
$view = Views::getView('test_tracker_user_uid');
$this->executeView($view);
// We should have no results as the filter is set for uid 0.
$this->assertIdenticalResultSet($view, array(), $map);
$this->assertIdenticalResultSet($view, [], $map);
$view->destroy();
// Change the filter value to our user.
@@ -55,13 +55,13 @@ class TrackerUserUidTest extends TrackerTestBase {
// Test the incorrect argument UID.
$view->initHandlers();
$this->executeView($view, array(rand()));
$this->assertIdenticalResultSet($view, array(), $map);
$this->executeView($view, [rand()]);
$this->assertIdenticalResultSet($view, [], $map);
$view->destroy();
// Test the correct argument UID.
$view->initHandlers();
$this->executeView($view, array($this->node->getOwnerId()));
$this->executeView($view, [$this->node->getOwnerId()]);
$this->assertIdenticalResultSet($view, $expected, $map);
}