Commit bf78c2ec authored by RenatoG's avatar RenatoG Committed by RenatoG

Issue #2906586 by RenatoG: Fix Drupal Coding Standards and Drupal Best...

Issue #2906586 by RenatoG: Fix Drupal Coding Standards and Drupal Best practices for XML sitemap user
parent ad8d6ad6
......@@ -3,6 +3,4 @@ description = Adds user profile links to the sitemap.
package = XML sitemap
dependencies[] = xmlsitemap
core = 7.x
files[] = xmlsitemap_user.module
files[] = xmlsitemap_user.install
files[] = xmlsitemap_user.test
<?php
/**
* @file
* Default file for XML sitemap user.
*/
/**
* Implements hook_entity_info_alter().
*/
......@@ -30,7 +35,7 @@ function xmlsitemap_user_xmlsitemap_index_links($limit) {
/**
* Process user sitemap links.
*
* @param $uids
* @param array $uids
* An array of user IDs.
*/
function xmlsitemap_user_xmlsitemap_process_user_links(array $uids) {
......@@ -120,7 +125,7 @@ function xmlsitemap_user_form_user_admin_settings_alter(&$form, $form_state) {
*
* The link will be saved as $account->xmlsitemap.
*
* @param $account
* @param object $account
* A user object.
*/
function xmlsitemap_user_create_link(stdClass &$account) {
......@@ -155,7 +160,7 @@ function xmlsitemap_user_create_link(stdClass &$account) {
}
/**
* Implementation of hook_variables().
* Implements hook_variables().
*/
function xmlsitemap_user_variables() {
$defaults = array();
......
......@@ -5,10 +5,32 @@
* Unit tests for the xmlsitemap_user module.
*/
/**
* Tests for User Functional.
*/
class XMLSitemapUserFunctionalTest extends XMLSitemapTestHelper {
/**
* Normal User.
*
* @var string
*
* @codingStandardsIgnoreStart
*/
protected $normal_user;
/**
* Accounts.
*
* @var array
*/
protected $accounts = array();
/**
* Get Info.
*
* @codingStandardsIgnoreEnd
*/
public static function getInfo() {
return array(
'name' => 'XML sitemap user',
......@@ -17,15 +39,23 @@ class XMLSitemapUserFunctionalTest extends XMLSitemapTestHelper {
);
}
function setUp($modules = array()) {
/**
* Setup.
*/
public function setUp($modules = array()) {
$modules[] = 'xmlsitemap_user';
parent::setUp($modules);
// Save the user settings before creating the users.
xmlsitemap_link_bundle_settings_save('user', 'user', array('status' => 1, 'priority' => 0.5));
// Create the users
$this->admin_user = $this->drupalCreateUser(array('administer users', 'administer permissions', 'administer xmlsitemap'));
// Create the users.
$this->admin_user = $this->drupalCreateUser(array(
'administer users',
'administer permissions',
'administer xmlsitemap',
));
$this->normal_user = $this->drupalCreateUser(array('access content'));
// Update the normal user to make its sitemap link visible.
......@@ -33,7 +63,10 @@ class XMLSitemapUserFunctionalTest extends XMLSitemapTestHelper {
user_save($account, array('access' => 1, 'login' => 1));
}
function testBlockedUser() {
/**
* Blocked User().
*/
public function testBlockedUser() {
$this->drupalLogin($this->admin_user);
$this->assertSitemapLinkVisible('user', $this->normal_user->uid);
......@@ -47,4 +80,5 @@ class XMLSitemapUserFunctionalTest extends XMLSitemapTestHelper {
$this->assertText('The changes have been saved.');
$this->assertSitemapLinkNotVisible('user', $this->normal_user->uid);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment