Commit adaa39ea authored by jhodgdon's avatar jhodgdon
Browse files

Issue #1313980 by Albert Volkman, Lars Toomre, jn2, xjm: Massive API docs cleanup for Node module

parent e13cf753
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/** /**
* @file * @file
* Content type editing UI. * Content type editing user interface.
*/ */
/** /**
...@@ -426,8 +426,7 @@ function node_node_type_update($info) { ...@@ -426,8 +426,7 @@ function node_node_type_update($info) {
} }
/** /**
* Resets all of the relevant fields of a module-defined node type to their * Resets relevant fields of a module-defined node type to their default values.
* default values.
* *
* @param $type * @param $type
* The node type to reset. The node type is passed back by reference with its * The node type to reset. The node type is passed back by reference with its
...@@ -456,6 +455,7 @@ function node_type_reset($type) { ...@@ -456,6 +455,7 @@ function node_type_reset($type) {
* Form array for delete confirmation form. * Form array for delete confirmation form.
* *
* @see node_type_delete_confirm_submit() * @see node_type_delete_confirm_submit()
* @ingroup forms
*/ */
function node_type_delete_confirm($form, &$form_state, $type) { function node_type_delete_confirm($form, &$form_state, $type) {
$form['type'] = array('#type' => 'value', '#value' => $type->type); $form['type'] = array('#type' => 'value', '#value' => $type->type);
......
/**
* @file
* Javascript for the node content editing form.
*/
(function ($) { (function ($) {
"use strict"; "use strict";
......
...@@ -154,8 +154,8 @@ class Node extends Entity implements ContentEntityInterface { ...@@ -154,8 +154,8 @@ class Node extends Entity implements ContentEntityInterface {
/** /**
* The node promotion status. * The node promotion status.
* *
* Promoted nodes should be displayed on the front page of the site. The * Promoted nodes should be displayed on the front page of the site. The value
* value is either NODE_PROMOTED or NODE_NOT_PROMOTED. * is either NODE_PROMOTED or NODE_NOT_PROMOTED.
* *
* @var integer * @var integer
*/ */
...@@ -184,7 +184,7 @@ class Node extends Entity implements ContentEntityInterface { ...@@ -184,7 +184,7 @@ class Node extends Entity implements ContentEntityInterface {
/** /**
* The node translation status. * The node translation status.
* *
* If the translation page needs to be updated the value is 1, otherwise 0. * If the translation page needs to be updated, the value is 1; otherwise 0.
* *
* @var integer * @var integer
*/ */
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
/** /**
* Test multistep node forms basic options. * Tests basic options of multi-step node forms.
*/ */
class MultiStepNodeFormBasicOptionsTest extends WebTestBase { class MultiStepNodeFormBasicOptionsTest extends WebTestBase {
...@@ -37,7 +37,7 @@ function setUp() { ...@@ -37,7 +37,7 @@ function setUp() {
} }
/** /**
* Change the default values of basic options to ensure they persist. * Tests changing the default values of basic options to ensure they persist.
*/ */
function testMultiStepNodeFormBasicOptions() { function testMultiStepNodeFormBasicOptions() {
$edit = array( $edit = array(
......
...@@ -19,7 +19,13 @@ class NodeAccessBaseTableTest extends NodeTestBase { ...@@ -19,7 +19,13 @@ class NodeAccessBaseTableTest extends NodeTestBase {
*/ */
public static $modules = array('node_access_test'); public static $modules = array('node_access_test');
// Requires tags taxonomy field. /**
* The installation profile to use with this test.
*
* This test class requires the "tags" taxonomy field.
*
* @var string
*/
protected $profile = 'standard'; protected $profile = 'standard';
public static function getInfo() { public static function getInfo() {
...@@ -30,9 +36,6 @@ public static function getInfo() { ...@@ -30,9 +36,6 @@ public static function getInfo() {
); );
} }
/**
* Enable modules and create user with specific permissions.
*/
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
...@@ -41,7 +44,7 @@ public function setUp() { ...@@ -41,7 +44,7 @@ public function setUp() {
} }
/** /**
* Test the "private" node access. * Tests the "private" node access functionality.
* *
* - Create 2 users with "access content" and "create article" permissions. * - Create 2 users with "access content" and "create article" permissions.
* - Each user creates one private and one not private article. * - Each user creates one private and one not private article.
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
use Drupal\Core\Language\Language; use Drupal\Core\Language\Language;
/** /**
* Test case to verify node_access functionality for multiple languages. * Verifies node_access() functionality for multiple languages.
*/ */
class NodeAccessLanguageTest extends NodeTestBase { class NodeAccessLanguageTest extends NodeTestBase {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
namespace Drupal\node\Tests; namespace Drupal\node\Tests;
/** /**
* Rebuild the node_access table. * Verifies the rebuild functionality for the node_access table.
*/ */
class NodeAccessRebuildTest extends NodeTestBase { class NodeAccessRebuildTest extends NodeTestBase {
public static function getInfo() { public static function getInfo() {
...@@ -27,6 +27,9 @@ function setUp() { ...@@ -27,6 +27,9 @@ function setUp() {
$this->web_user = $web_user; $this->web_user = $web_user;
} }
/**
* Tests rebuilding the node access permissions table.
*/
function testNodeAccessRebuild() { function testNodeAccessRebuild() {
$this->drupalGet('admin/reports/status'); $this->drupalGet('admin/reports/status');
$this->clickLink(t('Rebuild permissions')); $this->clickLink(t('Rebuild permissions'));
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
namespace Drupal\node\Tests; namespace Drupal\node\Tests;
/** /**
* Test case to verify hook_node_access_records functionality. * Tests hook_node_access_records() functionality.
*/ */
class NodeAccessRecordsTest extends NodeTestBase { class NodeAccessRecordsTest extends NodeTestBase {
...@@ -28,7 +28,7 @@ public static function getInfo() { ...@@ -28,7 +28,7 @@ public static function getInfo() {
} }
/** /**
* Create a node and test the creation of node access rules. * Creates a node and tests the creation of node access rules.
*/ */
function testNodeAccessRecords() { function testNodeAccessRecords() {
// Create an article node. // Create an article node.
......
...@@ -8,9 +8,11 @@ ...@@ -8,9 +8,11 @@
namespace Drupal\node\Tests; namespace Drupal\node\Tests;
/** /**
* Test case to verify basic node_access functionality. * Tests basic node_access functionality.
*
* Note that hook_node_access_records() is covered in another test class.
*
* @todo Cover hook_node_access in a separate test class. * @todo Cover hook_node_access in a separate test class.
* hook_node_access_records is covered in another test class.
*/ */
class NodeAccessTest extends NodeTestBase { class NodeAccessTest extends NodeTestBase {
public static function getInfo() { public static function getInfo() {
...@@ -22,7 +24,7 @@ public static function getInfo() { ...@@ -22,7 +24,7 @@ public static function getInfo() {
} }
/** /**
* Asserts node_access correctly grants or denies access. * Asserts node_access() correctly grants or denies access.
*/ */
function assertNodeAccess($ops, $node, $account) { function assertNodeAccess($ops, $node, $account) {
foreach ($ops as $op => $result) { foreach ($ops as $op => $result) {
......
...@@ -8,9 +8,10 @@ ...@@ -8,9 +8,10 @@
namespace Drupal\node\Tests; namespace Drupal\node\Tests;
/** /**
* Test node administration page functionality. * Tests node administration page functionality.
*/ */
class NodeAdminTest extends NodeTestBase { class NodeAdminTest extends NodeTestBase {
public static function getInfo() { public static function getInfo() {
return array( return array(
'name' => 'Node administration', 'name' => 'Node administration',
...@@ -76,6 +77,7 @@ function testContentAdminSort() { ...@@ -76,6 +77,7 @@ function testContentAdminSort() {
* Tests content overview with different user permissions. * Tests content overview with different user permissions.
* *
* Taxonomy filters are tested separately. * Taxonomy filters are tested separately.
*
* @see TaxonomyNodeFilterTestCase * @see TaxonomyNodeFilterTestCase
*/ */
function testContentAdminPages() { function testContentAdminPages() {
......
...@@ -36,7 +36,7 @@ function setUp() { ...@@ -36,7 +36,7 @@ function setUp() {
} }
/** /**
* Test the recent comments block. * Tests the recent comments block.
*/ */
function testRecentNodeBlock() { function testRecentNodeBlock() {
$this->drupalLogin($this->admin_user); $this->drupalLogin($this->admin_user);
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
namespace Drupal\node\Tests; namespace Drupal\node\Tests;
/**
* Tests the availability of the syndicate block.
*/
class NodeBlockTest extends NodeTestBase { class NodeBlockTest extends NodeTestBase {
/** /**
......
...@@ -21,7 +21,7 @@ public static function getInfo() { ...@@ -21,7 +21,7 @@ public static function getInfo() {
} }
/** /**
* Test to ensure that a node's content array is rebuilt on every call to node_build_content(). * Ensures that content array is rebuilt on every call to node_build_content().
*/ */
function testNodeRebuildContent() { function testNodeRebuildContent() {
$node = $this->drupalCreateNode(); $node = $this->drupalCreateNode();
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
use Drupal\Core\Database\Database; use Drupal\Core\Database\Database;
use Exception; use Exception;
/**
* Tests creating and saving a node.
*/
class NodeCreationTest extends NodeTestBase { class NodeCreationTest extends NodeTestBase {
/** /**
...@@ -37,7 +40,7 @@ function setUp() { ...@@ -37,7 +40,7 @@ function setUp() {
} }
/** /**
* Create a "Basic page" node and verify its consistency in the database. * Creates a "Basic page" node and verifies its consistency in the database.
*/ */
function testNodeCreation() { function testNodeCreation() {
// Create a node. // Create a node.
...@@ -56,7 +59,7 @@ function testNodeCreation() { ...@@ -56,7 +59,7 @@ function testNodeCreation() {
} }
/** /**
* Create a page node and verify that a transaction rolls back the failed creation * Verifies that a transaction rolls back the failed creation.
*/ */
function testFailedPageCreation() { function testFailedPageCreation() {
// Create a node. // Create a node.
...@@ -97,7 +100,7 @@ function testFailedPageCreation() { ...@@ -97,7 +100,7 @@ function testFailedPageCreation() {
} }
/** /**
* Create an unpublished node and confirm correct redirect behavior. * Creates an unpublished node and confirms correct redirect behavior.
*/ */
function testUnpublishedNodeCreation() { function testUnpublishedNodeCreation() {
// Set the front page to the test page. // Set the front page to the test page.
......
...@@ -22,7 +22,7 @@ public static function getInfo() { ...@@ -22,7 +22,7 @@ public static function getInfo() {
} }
/** /**
* Ensure that node_feed accepts and prints extra channel elements. * Ensures that node_feed() accepts and prints extra channel elements.
*/ */
function testNodeFeedExtraChannelElements() { function testNodeFeedExtraChannelElements() {
$response = node_feed(array(), array('copyright' => 'Drupal is a registered trademark of Dries Buytaert.')); $response = node_feed(array(), array('copyright' => 'Drupal is a registered trademark of Dries Buytaert.'));
......
...@@ -65,7 +65,7 @@ function setUp() { ...@@ -65,7 +65,7 @@ function setUp() {
} }
/** /**
* Test if field languages are correctly set through the node form. * Tests whether field languages are correctly set through the node form.
*/ */
function testMultilingualNodeForm() { function testMultilingualNodeForm() {
// Create "Basic page" content. // Create "Basic page" content.
...@@ -113,7 +113,7 @@ function testMultilingualNodeForm() { ...@@ -113,7 +113,7 @@ function testMultilingualNodeForm() {
} }
/* /*
* Test multilingual field display settings. * Tests multilingual field display settings.
*/ */
function testMultilingualDisplaySettings() { function testMultilingualDisplaySettings() {
// Create "Basic page" content. // Create "Basic page" content.
......
...@@ -8,9 +8,10 @@ ...@@ -8,9 +8,10 @@
namespace Drupal\node\Tests; namespace Drupal\node\Tests;
/** /**
* Check that the post information displays when enabled for a content type. * Checks that the post information displays when enabled for a content type.
*/ */
class NodePostSettingsTest extends NodeTestBase { class NodePostSettingsTest extends NodeTestBase {
public static function getInfo() { public static function getInfo() {
return array( return array(
'name' => 'Node post information display', 'name' => 'Node post information display',
...@@ -27,7 +28,7 @@ function setUp() { ...@@ -27,7 +28,7 @@ function setUp() {
} }
/** /**
* Set "Basic page" content type to display post information and confirm its presence on a new node. * Confirms "Basic page" content type and post information is on a new node.
*/ */
function testPagePostInfo() { function testPagePostInfo() {
...@@ -50,7 +51,7 @@ function testPagePostInfo() { ...@@ -50,7 +51,7 @@ function testPagePostInfo() {
} }
/** /**
* Set "Basic page" content type to not display post information and confirm its absence on a new node. * Confirms absence of post information on a new node.
*/ */
function testPageNotPostInfo() { function testPageNotPostInfo() {
......
...@@ -83,10 +83,10 @@ function testNodeQueryAlterWithUI() { ...@@ -83,10 +83,10 @@ function testNodeQueryAlterWithUI() {
} }
/** /**
* Lower-level test of 'node_access' query alter, for user with access. * Tests 'node_access' query alter, for user with access.
* *
* Verifies that a non-standard table alias can be used, and that a * Verifies that a non-standard table alias can be used, and that a user with
* user with node access can view the nodes. * node access can view the nodes.
*/ */
function testNodeQueryAlterLowLevelWithAccess() { function testNodeQueryAlterLowLevelWithAccess() {
// User with access should be able to view 4 nodes. // User with access should be able to view 4 nodes.
...@@ -106,10 +106,10 @@ function testNodeQueryAlterLowLevelWithAccess() { ...@@ -106,10 +106,10 @@ function testNodeQueryAlterLowLevelWithAccess() {
} }
/** /**
* Lower-level test of 'node_access' query alter, for user without access. * Tests 'node_access' query alter, for user without access.
* *
* Verifies that a non-standard table alias can be used, and that a * Verifies that a non-standard table alias can be used, and that a user
* user without node access cannot view the nodes. * without node access cannot view the nodes.
*/ */
function testNodeQueryAlterLowLevelNoAccess() { function testNodeQueryAlterLowLevelNoAccess() {
// User without access should be able to view 0 nodes. // User without access should be able to view 0 nodes.
...@@ -129,10 +129,10 @@ function testNodeQueryAlterLowLevelNoAccess() { ...@@ -129,10 +129,10 @@ function testNodeQueryAlterLowLevelNoAccess() {
} }
/** /**
* Lower-level test of 'node_access' query alter, for edit access. * Tests 'node_access' query alter, for edit access.
* *
* Verifies that a non-standard table alias can be used, and that a * Verifies that a non-standard table alias can be used, and that a user with
* user with view-only node access cannot edit the nodes. * view-only node access cannot edit the nodes.
*/ */
function testNodeQueryAlterLowLevelEditAccess() { function testNodeQueryAlterLowLevelEditAccess() {
// User with view-only access should not be able to edit nodes. // User with view-only access should not be able to edit nodes.
...@@ -154,13 +154,13 @@ function testNodeQueryAlterLowLevelEditAccess() { ...@@ -154,13 +154,13 @@ function testNodeQueryAlterLowLevelEditAccess() {
} }
/** /**
* Lower-level test of 'node_access' query alter override. * Tests 'node_access' query alter override.
* *
* Verifies that node_access_view_all_nodes() is called from * Verifies that node_access_view_all_nodes() is called from
* node_query_node_access_alter(). We do this by checking that * node_query_node_access_alter(). We do this by checking that a user who
* a user which normally would not have view privileges is able * normally would not have view privileges is able to view the nodes when we
* to view the nodes when we add a record to {node_access} paired * add a record to {node_access} paired with a corresponding privilege in
* with a corresponding privilege in hook_node_grants(). * hook_node_grants().
*/ */
function testNodeQueryAlterOverride() { function testNodeQueryAlterOverride() {
$record = array( $record = array(
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
namespace Drupal\node\Tests; namespace Drupal\node\Tests;
/** /**
* Ensure that data added to nodes by other modules appears in RSS feeds. * Ensures that data added to nodes by other modules appears in RSS feeds.
* *
* Create a node, enable the node_test module to ensure that extra data is * Create a node, enable the node_test module to ensure that extra data is
* added to the node->content array, then verify that the data appears on the * added to the node->content array, then verify that the data appears on the
...@@ -42,8 +42,7 @@ function setUp() { ...@@ -42,8 +42,7 @@ function setUp() {
} }
/** /**
* Create a new node and ensure that it includes the custom data when added * Ensures that a new node includes the custom data when added to an RSS feed.
* to an RSS feed.
*/ */
function testNodeRSSContent() { function testNodeRSSContent() {
// Create a node. // Create a node.
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
namespace Drupal\node\Tests; namespace Drupal\node\Tests;
/**
* Tests the node revision functionality.
*/
class NodeRevisionsTest extends NodeTestBase { class NodeRevisionsTest extends NodeTestBase {
protected $nodes; protected $nodes;
protected $