Commit dd5d0f61 authored by jhodgdon's avatar jhodgdon

Issue #1797200 by pillarsdotnet, boombatower, solotandem, ZenDoodles, sun,...

Issue #1797200 by pillarsdotnet, boombatower, solotandem, ZenDoodles, sun, xjm, yched, Damien Tournoud: (crediting those who worked on previous versions of this patch as well) Remove t() from test assertions in node module
parent ad7b2772
......@@ -84,7 +84,7 @@ function testNodeAccessBasic() {
$this->drupalPost('node/add/article', $edit, t('Save'));
$nid = db_query('SELECT nid FROM {node} WHERE title = :title', array(':title' => $edit['title']))->fetchField();
$private_status = db_query('SELECT private FROM {node_access_test} where nid = :nid', array(':nid' => $nid))->fetchField();
$this->assertTrue($is_private == $private_status, t('The private status of the node was properly set in the node_access_test table.'));
$this->assertTrue($is_private == $private_status, 'The private status of the node was properly set in the node_access_test table.');
if ($is_private) {
$private_nodes[] = $nid;
}
......@@ -94,8 +94,8 @@ function testNodeAccessBasic() {
}
$this->publicTid = db_query('SELECT tid FROM {taxonomy_term_data} WHERE name = :name', array(':name' => 'public'))->fetchField();
$this->privateTid = db_query('SELECT tid FROM {taxonomy_term_data} WHERE name = :name', array(':name' => 'private'))->fetchField();
$this->assertTrue($this->publicTid, t('Public tid was found'));
$this->assertTrue($this->privateTid, t('Private tid was found'));
$this->assertTrue($this->publicTid, 'Public tid was found');
$this->assertTrue($this->privateTid, 'Private tid was found');
foreach ($simple_users as $this->webUser) {
$this->drupalLogin($this->webUser);
// Check own nodes to see that all are readable.
......
......@@ -65,7 +65,7 @@ function testNodeAccess() {
// Tests the default access provided for a published Hungarian node.
$web_user = $this->drupalCreateUser(array('access content'));
$node = $this->drupalCreateNode(array('body' => array('hu' => array(array())), 'langcode' => 'hu'));
$this->assertTrue($node->langcode == 'hu', t('Node created as Hungarian.'));
$this->assertTrue($node->langcode == 'hu', 'Node created as Hungarian.');
$expected_node_access = array('view' => TRUE, 'update' => FALSE, 'delete' => FALSE);
$this->assertNodeAccess($expected_node_access, $node, $web_user);
......
......@@ -33,44 +33,44 @@ public static function getInfo() {
function testNodeAccessRecords() {
// Create an article node.
$node1 = $this->drupalCreateNode(array('type' => 'article'));
$this->assertTrue(node_load($node1->nid), t('Article node created.'));
$this->assertTrue(node_load($node1->nid), 'Article node created.');
// Check to see if grants added by node_test_node_access_records made it in.
$records = db_query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', array(':nid' => $node1->nid))->fetchAll();
$this->assertEqual(count($records), 1, t('Returned the correct number of rows.'));
$this->assertEqual($records[0]->realm, 'test_article_realm', t('Grant with article_realm acquired for node without alteration.'));
$this->assertEqual($records[0]->gid, 1, t('Grant with gid = 1 acquired for node without alteration.'));
$this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
$this->assertEqual($records[0]->realm, 'test_article_realm', 'Grant with article_realm acquired for node without alteration.');
$this->assertEqual($records[0]->gid, 1, 'Grant with gid = 1 acquired for node without alteration.');
// Create an unpromoted "Basic page" node.
$node2 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 0));
$this->assertTrue(node_load($node2->nid), t('Unpromoted basic page node created.'));
$this->assertTrue(node_load($node2->nid), 'Unpromoted basic page node created.');
// Check to see if grants added by node_test_node_access_records made it in.
$records = db_query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', array(':nid' => $node2->nid))->fetchAll();
$this->assertEqual(count($records), 1, t('Returned the correct number of rows.'));
$this->assertEqual($records[0]->realm, 'test_page_realm', t('Grant with page_realm acquired for node without alteration.'));
$this->assertEqual($records[0]->gid, 1, t('Grant with gid = 1 acquired for node without alteration.'));
$this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
$this->assertEqual($records[0]->realm, 'test_page_realm', 'Grant with page_realm acquired for node without alteration.');
$this->assertEqual($records[0]->gid, 1, 'Grant with gid = 1 acquired for node without alteration.');
// Create an unpromoted, unpublished "Basic page" node.
$node3 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 0, 'status' => 0));
$this->assertTrue(node_load($node3->nid), t('Unpromoted, unpublished basic page node created.'));
$this->assertTrue(node_load($node3->nid), 'Unpromoted, unpublished basic page node created.');
// Check to see if grants added by node_test_node_access_records made it in.
$records = db_query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', array(':nid' => $node3->nid))->fetchAll();
$this->assertEqual(count($records), 1, t('Returned the correct number of rows.'));
$this->assertEqual($records[0]->realm, 'test_page_realm', t('Grant with page_realm acquired for node without alteration.'));
$this->assertEqual($records[0]->gid, 1, t('Grant with gid = 1 acquired for node without alteration.'));
$this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
$this->assertEqual($records[0]->realm, 'test_page_realm', 'Grant with page_realm acquired for node without alteration.');
$this->assertEqual($records[0]->gid, 1, 'Grant with gid = 1 acquired for node without alteration.');
// Create a promoted "Basic page" node.
$node4 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1));
$this->assertTrue(node_load($node4->nid), t('Promoted basic page node created.'));
$this->assertTrue(node_load($node4->nid), 'Promoted basic page node created.');
// Check to see if grant added by node_test_node_access_records was altered
// by node_test_node_access_records_alter.
$records = db_query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', array(':nid' => $node4->nid))->fetchAll();
$this->assertEqual(count($records), 1, t('Returned the correct number of rows.'));
$this->assertEqual($records[0]->realm, 'test_alter_realm', t('Altered grant with alter_realm acquired for node.'));
$this->assertEqual($records[0]->gid, 2, t('Altered grant with gid = 2 acquired for node.'));
$this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
$this->assertEqual($records[0]->realm, 'test_alter_realm', 'Altered grant with alter_realm acquired for node.');
$this->assertEqual($records[0]->gid, 2, 'Altered grant with gid = 2 acquired for node.');
// Check to see if we can alter grants with hook_node_grants_alter().
$operations = array('view', 'update', 'delete');
......@@ -87,6 +87,6 @@ function testNodeAccessRecords() {
// empty $grants array is returned.
$node6 = $this->drupalCreateNode(array('status' => 0, 'disable_node_access' => TRUE));
$records = db_query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', array(':nid' => $node6->nid))->fetchAll();
$this->assertEqual(count($records), 0, t('Returned no records for unpublished node.'));
$this->assertEqual(count($records), 0, 'Returned no records for unpublished node.');
}
}
......@@ -94,7 +94,7 @@ function testContentAdminPages() {
$this->assertLinkByHref('node/' . $node->nid . '/edit');
$this->assertLinkByHref('node/' . $node->nid . '/delete');
// Verify tableselect.
$this->assertFieldByName('nodes[' . $node->nid . ']', '', t('Tableselect found.'));
$this->assertFieldByName('nodes[' . $node->nid . ']', '', 'Tableselect found.');
}
// Verify filtering by publishing status.
......@@ -103,7 +103,7 @@ function testContentAdminPages() {
);
$this->drupalPost(NULL, $edit, t('Filter'));
$this->assertRaw(t('where %property is %value', array('%property' => t('status'), '%value' => 'published')), t('Content list is filtered by status.'));
$this->assertRaw(t('where %property is %value', array('%property' => t('status'), '%value' => 'published')), 'Content list is filtered by status.');
$this->assertLinkByHref('node/' . $nodes['published_page']->nid . '/edit');
$this->assertLinkByHref('node/' . $nodes['published_article']->nid . '/edit');
......@@ -115,8 +115,8 @@ function testContentAdminPages() {
);
$this->drupalPost(NULL, $edit, t('Refine'));
$this->assertRaw(t('where %property is %value', array('%property' => t('status'), '%value' => 'published')), t('Content list is filtered by status.'));
$this->assertRaw(t('and where %property is %value', array('%property' => t('type'), '%value' => 'Basic page')), t('Content list is filtered by content type.'));
$this->assertRaw(t('where %property is %value', array('%property' => t('status'), '%value' => 'published')), 'Content list is filtered by status.');
$this->assertRaw(t('and where %property is %value', array('%property' => t('type'), '%value' => 'Basic page')), 'Content list is filtered by content type.');
$this->assertLinkByHref('node/' . $nodes['published_page']->nid . '/edit');
$this->assertNoLinkByHref('node/' . $nodes['published_article']->nid . '/edit');
......@@ -139,7 +139,7 @@ function testContentAdminPages() {
$this->assertNoLinkByHref('node/' . $nodes['unpublished_page_1']->nid . '/delete');
// Verify no tableselect.
$this->assertNoFieldByName('nodes[' . $nodes['published_page']->nid . ']', '', t('No tableselect found.'));
$this->assertNoFieldByName('nodes[' . $nodes['published_page']->nid . ']', '', 'No tableselect found.');
// Verify unpublished content is displayed with permission.
$this->drupalLogout();
......@@ -157,7 +157,7 @@ function testContentAdminPages() {
$this->assertNoLinkByHref('node/' . $nodes['unpublished_page_1']->nid . '/delete');
// Verify no tableselect.
$this->assertNoFieldByName('nodes[' . $nodes['unpublished_page_2']->nid . ']', '', t('No tableselect found.'));
$this->assertNoFieldByName('nodes[' . $nodes['unpublished_page_2']->nid . ']', '', 'No tableselect found.');
// Verify node access can be bypassed.
$this->drupalLogout();
......
......@@ -51,7 +51,7 @@ function testRecentNodeBlock() {
'blocks[node_recent][region]' => 'sidebar_first',
);
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
$this->assertText(t('The block settings have been updated.'), t('Block saved to first sidebar region.'));
$this->assertText(t('The block settings have been updated.'), 'Block saved to first sidebar region.');
// Set block title and variables.
$block = array(
......@@ -59,11 +59,11 @@ function testRecentNodeBlock() {
'node_recent_block_count' => 2,
);
$this->drupalPost('admin/structure/block/manage/node/recent/configure', $block, t('Save block'));
$this->assertText(t('The block configuration has been saved.'), t('Block saved.'));
$this->assertText(t('The block configuration has been saved.'), 'Block saved.');
// Test that block is not visible without nodes
$this->drupalGet('');
$this->assertText(t('No content available.'), t('Block with "No content available." found.'));
$this->assertText(t('No content available.'), 'Block with "No content available." found.');
// Add some test nodes.
$default_settings = array('uid' => $this->web_user->uid, 'type' => 'article');
......@@ -89,16 +89,16 @@ function testRecentNodeBlock() {
// see the block.
$this->drupalLogout();
$this->drupalGet('');
$this->assertNoText($block['title'], t('Block was not found.'));
$this->assertNoText($block['title'], 'Block was not found.');
// Test that only the 2 latest nodes are shown.
$this->drupalLogin($this->web_user);
$this->assertNoText($node1->label(), t('Node not found in block.'));
$this->assertText($node2->label(), t('Node found in block.'));
$this->assertText($node3->label(), t('Node found in block.'));
$this->assertNoText($node1->label(), 'Node not found in block.');
$this->assertText($node2->label(), 'Node found in block.');
$this->assertText($node3->label(), 'Node found in block.');
// Check to make sure nodes are in the right order.
$this->assertTrue($this->xpath('//div[@id="block-node-recent"]/div/table/tbody/tr[position() = 1]/td/div/a[text() = "' . $node3->label() . '"]'), t('Nodes were ordered correctly in block.'));
$this->assertTrue($this->xpath('//div[@id="block-node-recent"]/div/table/tbody/tr[position() = 1]/td/div/a[text() = "' . $node3->label() . '"]'), 'Nodes were ordered correctly in block.');
// Set the number of recent nodes to show to 10.
$this->drupalLogout();
......@@ -107,7 +107,7 @@ function testRecentNodeBlock() {
'node_recent_block_count' => 10,
);
$this->drupalPost('admin/structure/block/manage/node/recent/configure', $block, t('Save block'));
$this->assertText(t('The block configuration has been saved.'), t('Block saved.'));
$this->assertText(t('The block configuration has been saved.'), 'Block saved.');
// Post an additional node.
$node4 = $this->drupalCreateNode($default_settings);
......@@ -117,10 +117,10 @@ function testRecentNodeBlock() {
// Test that all four nodes are shown.
$this->drupalGet('');
$this->assertText($node1->label(), t('Node found in block.'));
$this->assertText($node2->label(), t('Node found in block.'));
$this->assertText($node3->label(), t('Node found in block.'));
$this->assertText($node4->label(), t('Node found in block.'));
$this->assertText($node1->label(), 'Node found in block.');
$this->assertText($node2->label(), 'Node found in block.');
$this->assertText($node3->label(), 'Node found in block.');
$this->assertText($node4->label(), 'Node found in block.');
// Create the custom block.
$custom_block = array();
......@@ -135,19 +135,19 @@ function testRecentNodeBlock() {
$this->drupalPost('admin/structure/block/add', $custom_block, t('Save block'));
$bid = db_query("SELECT bid FROM {block_custom} WHERE info = :info", array(':info' => $custom_block['info']))->fetchField();
$this->assertTrue($bid, t('Custom block with visibility rule was created.'));
$this->assertTrue($bid, 'Custom block with visibility rule was created.');
// Verify visibility rules.
$this->drupalGet('');
$this->assertNoText($custom_block['title'], t('Block was displayed on the front page.'));
$this->assertNoText($custom_block['title'], 'Block was displayed on the front page.');
$this->drupalGet('node/add/article');
$this->assertText($custom_block['title'], t('Block was displayed on the node/add/article page.'));
$this->assertText($custom_block['title'], 'Block was displayed on the node/add/article page.');
$this->drupalGet('node/' . $node1->nid);
$this->assertText($custom_block['title'], t('Block was displayed on the node/N.'));
$this->assertText($custom_block['title'], 'Block was displayed on the node/N.');
// Delete the created custom block & verify that it's been deleted.
$this->drupalPost('admin/structure/block/manage/block/' . $bid . '/delete', array(), t('Delete'));
$bid = db_query("SELECT 1 FROM {block_node_type} WHERE module = 'block' AND delta = :delta", array(':delta' => $bid))->fetchField();
$this->assertFalse($bid, t('Custom block was deleted.'));
$this->assertFalse($bid, 'Custom block was deleted.');
}
}
......@@ -35,12 +35,12 @@ function setUp() {
function testSearchFormBlock() {
// Set block title to confirm that the interface is available.
$this->drupalPost('admin/structure/block/manage/node/syndicate/configure', array('title' => $this->randomName(8)), t('Save block'));
$this->assertText(t('The block configuration has been saved.'), t('Block configuration set.'));
$this->assertText(t('The block configuration has been saved.'), 'Block configuration set.');
// Set the block to a region to confirm block is available.
$edit = array();
$edit['blocks[node_syndicate][region]'] = 'footer';
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
$this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.'));
$this->assertText(t('The block settings have been updated.'), 'Block successfully move to footer region.');
}
}
......@@ -31,6 +31,6 @@ function testNodeRebuildContent() {
$content = node_build_content($node);
// If the property doesn't exist it means the node->content was rebuilt.
$this->assertFalse(isset($content['test_content_property']), t('Node content was emptied prior to being built.'));
$this->assertFalse(isset($content['test_content_property']), 'Node content was emptied prior to being built.');
}
}
......@@ -48,11 +48,11 @@ function testNodeCreation() {
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the Basic page has been created.
$this->assertRaw(t('!post %title has been created.', array('!post' => 'Basic page', '%title' => $edit["title"])), t('Basic page created.'));
$this->assertRaw(t('!post %title has been created.', array('!post' => 'Basic page', '%title' => $edit["title"])), 'Basic page created.');
// Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit["title"]);
$this->assertTrue($node, t('Node found in database.'));
$this->assertTrue($node, 'Node found in database.');
}
/**
......@@ -79,21 +79,21 @@ function testFailedPageCreation() {
if (Database::getConnection()->supportsTransactions()) {
// Check that the node does not exist in the database.
$node = $this->drupalGetNodeByTitle($edit['title']);
$this->assertFalse($node, t('Transactions supported, and node not found in database.'));
$this->assertFalse($node, 'Transactions supported, and node not found in database.');
}
else {
// Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit['title']);
$this->assertTrue($node, t('Transactions not supported, and node found in database.'));
$this->assertTrue($node, 'Transactions not supported, and node found in database.');
// Check that the failed rollback was logged.
$records = db_query("SELECT wid FROM {watchdog} WHERE message LIKE 'Explicit rollback failed%'")->fetchAll();
$this->assertTrue(count($records) > 0, t('Transactions not supported, and rollback error logged to watchdog.'));
$this->assertTrue(count($records) > 0, 'Transactions not supported, and rollback error logged to watchdog.');
}
// Check that the rollback error was logged.
$records = db_query("SELECT wid FROM {watchdog} WHERE variables LIKE '%Test exception for rollback.%'")->fetchAll();
$this->assertTrue(count($records) > 0, t('Rollback explanatory error logged to watchdog.'));
$this->assertTrue(count($records) > 0, 'Rollback explanatory error logged to watchdog.');
}
/**
......@@ -112,6 +112,6 @@ function testUnpublishedNodeCreation() {
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the user was redirected to the home page.
$this->assertText(t('Welcome to Drupal'), t('The user is redirected to the home page.'));
$this->assertText(t('Welcome to Drupal'), 'The user is redirected to the home page.');
}
}
......@@ -56,7 +56,7 @@ function setUp() {
'node_type_language_hidden' => FALSE,
);
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
$this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), t('Basic page content type has been updated.'));
$this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), 'Basic page content type has been updated.');
// Make node body translatable.
$field = field_info_field('body');
......@@ -83,10 +83,10 @@ function testMultilingualNodeForm() {
// Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit[$title_key]);
$this->assertTrue($node, t('Node found in database.'));
$this->assertTrue($node, 'Node found in database.');
$assert = isset($node->body['en']) && !isset($node->body[LANGUAGE_NOT_SPECIFIED]) && $node->body['en'][0]['value'] == $body_value;
$this->assertTrue($assert, t('Field language correctly set.'));
$this->assertTrue($assert, 'Field language correctly set.');
// Change node language.
$this->drupalGet("node/$node->nid/edit");
......@@ -96,20 +96,20 @@ function testMultilingualNodeForm() {
);
$this->drupalPost(NULL, $edit, t('Save'));
$node = $this->drupalGetNodeByTitle($edit[$title_key], TRUE);
$this->assertTrue($node, t('Node found in database.'));
$this->assertTrue($node, 'Node found in database.');
$assert = isset($node->body['it']) && !isset($node->body['en']) && $node->body['it'][0]['value'] == $body_value;
$this->assertTrue($assert, t('Field language correctly changed.'));
$this->assertTrue($assert, 'Field language correctly changed.');
// Enable content language URL detection.
language_negotiation_set(LANGUAGE_TYPE_CONTENT, array(LANGUAGE_NEGOTIATION_URL => 0));
// Test multilingual field language fallback logic.
$this->drupalGet("it/node/$node->nid");
$this->assertRaw($body_value, t('Body correctly displayed using Italian as requested language'));
$this->assertRaw($body_value, 'Body correctly displayed using Italian as requested language');
$this->drupalGet("node/$node->nid");
$this->assertRaw($body_value, t('Body correctly displayed using English as requested language'));
$this->assertRaw($body_value, 'Body correctly displayed using English as requested language');
}
/*
......@@ -131,7 +131,7 @@ function testMultilingualDisplaySettings() {
// Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit[$title_key]);
$this->assertTrue($node, t('Node found in database.'));
$this->assertTrue($node, 'Node found in database.');
// Check if node body is showed.
$this->drupalGet("node/$node->nid");
......
......@@ -37,15 +37,15 @@ function testNodeMultipleLoad() {
// Confirm that promoted nodes appear in the default node listing.
$this->drupalGet('node');
$this->assertText($node1->label(), t('Node title appears on the default listing.'));
$this->assertText($node2->label(), t('Node title appears on the default listing.'));
$this->assertNoText($node3->label(), t('Node title does not appear in the default listing.'));
$this->assertNoText($node4->label(), t('Node title does not appear in the default listing.'));
$this->assertText($node1->label(), 'Node title appears on the default listing.');
$this->assertText($node2->label(), 'Node title appears on the default listing.');
$this->assertNoText($node3->label(), 'Node title does not appear in the default listing.');
$this->assertNoText($node4->label(), 'Node title does not appear in the default listing.');
// Load nodes with only a condition. Nodes 3 and 4 will be loaded.
$nodes = entity_load_multiple_by_properties('node', array('promote' => 0));
$this->assertEqual($node3->label(), $nodes[$node3->nid]->label(), t('Node was loaded.'));
$this->assertEqual($node4->label(), $nodes[$node4->nid]->label(), t('Node was loaded.'));
$this->assertEqual($node3->label(), $nodes[$node3->nid]->label(), 'Node was loaded.');
$this->assertEqual($node4->label(), $nodes[$node4->nid]->label(), 'Node was loaded.');
$count = count($nodes);
$this->assertTrue($count == 2, t('@count nodes loaded.', array('@count' => $count)));
......@@ -53,11 +53,11 @@ function testNodeMultipleLoad() {
$nodes = node_load_multiple(array(1, 2, 4));
$count = count($nodes);
$this->assertTrue(count($nodes) == 3, t('@count nodes loaded', array('@count' => $count)));
$this->assertTrue(isset($nodes[$node1->nid]), t('Node is correctly keyed in the array'));
$this->assertTrue(isset($nodes[$node2->nid]), t('Node is correctly keyed in the array'));
$this->assertTrue(isset($nodes[$node4->nid]), t('Node is correctly keyed in the array'));
$this->assertTrue(isset($nodes[$node1->nid]), 'Node is correctly keyed in the array');
$this->assertTrue(isset($nodes[$node2->nid]), 'Node is correctly keyed in the array');
$this->assertTrue(isset($nodes[$node4->nid]), 'Node is correctly keyed in the array');
foreach ($nodes as $node) {
$this->assertTrue(is_object($node), t('Node is an object'));
$this->assertTrue(is_object($node), 'Node is an object');
}
}
}
......@@ -46,7 +46,7 @@ function testPagePostInfo() {
// Check that the post information is displayed.
$node = $this->drupalGetNodeByTitle($edit["title"]);
$elements = $this->xpath('//*[contains(@class,:class)]', array(':class' => 'submitted'));
$this->assertEqual(count($elements), 1, t('Post information is displayed.'));
$this->assertEqual(count($elements), 1, 'Post information is displayed.');
}
/**
......@@ -68,6 +68,6 @@ function testPageNotPostInfo() {
// Check that the post information is displayed.
$node = $this->drupalGetNodeByTitle($edit["title"]);
$this->assertNoRaw('<span class="submitted">', t('Post information is not displayed.'));
$this->assertNoRaw('<span class="submitted">', 'Post information is not displayed.');
}
}
......@@ -98,7 +98,7 @@ function testNodeQueryAlterLowLevelWithAccess() {
$query->addMetaData('account', $this->accessUser);
$result = $query->execute()->fetchAll();
$this->assertEqual(count($result), 4, t('User with access can see correct nodes'));
$this->assertEqual(count($result), 4, 'User with access can see correct nodes');
}
catch (Exception $e) {
$this->fail(t('Altered query is malformed'));
......@@ -121,7 +121,7 @@ function testNodeQueryAlterLowLevelNoAccess() {
$query->addMetaData('account', $this->noAccessUser);
$result = $query->execute()->fetchAll();
$this->assertEqual(count($result), 0, t('User with no access cannot see nodes'));
$this->assertEqual(count($result), 0, 'User with no access cannot see nodes');
}
catch (Exception $e) {
$this->fail(t('Altered query is malformed'));
......@@ -144,7 +144,7 @@ function testNodeQueryAlterLowLevelEditAccess() {
$query->addMetaData('account', $this->accessUser);
$result = $query->execute()->fetchAll();
$this->assertEqual(count($result), 0, t('User with view-only access cannot edit nodes'));
$this->assertEqual(count($result), 0, 'User with view-only access cannot edit nodes');
}
catch (Exception $e) {
$this->fail($e->getMessage());
......@@ -184,7 +184,7 @@ function testNodeQueryAlterOverride() {
$query->addMetaData('account', $this->noAccessUser);
$result = $query->execute()->fetchAll();
$this->assertEqual(count($result), 0, t('User view privileges are not overridden'));
$this->assertEqual(count($result), 0, 'User view privileges are not overridden');
}
catch (Exception $e) {
$this->fail(t('Altered query is malformed'));
......@@ -206,7 +206,7 @@ function testNodeQueryAlterOverride() {
$query->addMetaData('account', $this->noAccessUser);
$result = $query->execute()->fetchAll();
$this->assertEqual(count($result), 4, t('User view privileges are overridden'));
$this->assertEqual(count($result), 4, 'User view privileges are overridden');
}
catch (Exception $e) {
$this->fail(t('Altered query is malformed'));
......
......@@ -53,7 +53,7 @@ function testNodeRSSContent() {
// Check that content added in 'rss' view mode appear in RSS feed.
$rss_only_content = t('Extra data that should appear only in the RSS feed for node !nid.', array('!nid' => $node->nid));
$this->assertText($rss_only_content, t('Node content designated for RSS appear in RSS feed.'));
$this->assertText($rss_only_content, 'Node content designated for RSS appear in RSS feed.');
// Check that content added in view modes other than 'rss' doesn't
// appear in RSS feed.
......@@ -66,8 +66,8 @@ function testNodeRSSContent() {
'value' => t('Value of testElement RSS element for node !nid.', array('!nid' => $node->nid)),
);
$test_ns = 'xmlns:drupaltest="http://example.com/test-namespace"';
$this->assertRaw(format_xml_elements(array($test_element)), t('Extra RSS elements appear in RSS feed.'));
$this->assertRaw($test_ns, t('Extra namespaces appear in RSS feed.'));
$this->assertRaw(format_xml_elements(array($test_element)), 'Extra RSS elements appear in RSS feed.');
$this->assertRaw($test_ns, 'Extra namespaces appear in RSS feed.');
// Check that content added in 'rss' view mode doesn't appear when
// viewing node.
......@@ -77,6 +77,6 @@ function testNodeRSSContent() {
// Check that the node feed page does not try to interpret additional path
// components as arguments for node_feed() and returns default content.
$this->drupalGet('rss.xml/' . $this->randomName() . '/' . $this->randomName());
$this->assertText($rss_only_content, t('Ignore page arguments when delivering rss.xml.'));
$this->assertText($rss_only_content, 'Ignore page arguments when delivering rss.xml.');
}
}
......@@ -69,12 +69,12 @@ function testRevisions() {
// Confirm the correct revision text appears on "view revisions" page.
$this->drupalGet("node/$node->nid/revisions/$node->vid/view");
$this->assertText($node->body[LANGUAGE_NOT_SPECIFIED][0]['value'], t('Correct text displays for version.'));
$this->assertText($node->body[LANGUAGE_NOT_SPECIFIED][0]['value'], 'Correct text displays for version.');
// Confirm the correct log message appears on "revisions overview" page.
$this->drupalGet("node/$node->nid/revisions");
foreach ($logs as $log) {
$this->assertText($log, t('Log message found.'));
$this->assertText($log, 'Log message found.');
}
// Confirm that this is the default revision.
......@@ -86,7 +86,7 @@ function testRevisions() {
array('@type' => 'Basic page', '%title' => $nodes[1]->label(),
'%revision-date' => format_date($nodes[1]->revision_timestamp))), t('Revision reverted.'));
$reverted_node = node_load($node->nid);
$this->assertTrue(($nodes[1]->body[LANGUAGE_NOT_SPECIFIED][0]['value'] == $reverted_node->body[LANGUAGE_NOT_SPECIFIED][0]['value']), t('Node reverted correctly.'));
$this->assertTrue(($nodes[1]->body[LANGUAGE_NOT_SPECIFIED][0]['value'] == $reverted_node->body[LANGUAGE_NOT_SPECIFIED][0]['value']), 'Node reverted correctly.');
// Confirm that this is not the default version.
$node = node_revision_load($node->vid);
......@@ -97,7 +97,7 @@ function testRevisions() {
$this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.',
array('%revision-date' => format_date($nodes[1]->revision_timestamp),
'@type' => 'Basic page', '%title' => $nodes[1]->label())), t('Revision deleted.'));
$this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid and vid = :vid', array(':nid' => $node->nid, ':vid' => $nodes[1]->vid))->fetchField() == 0, t('Revision not found.'));
$this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid and vid = :vid', array(':nid' => $node->nid, ':vid' => $nodes[1]->vid))->fetchField() == 0, 'Revision not found.');
// Set the revision timestamp to an older date to make sure that the
// confirmation message correctly displays the stored revision date.
......@@ -126,11 +126,11 @@ function testRevisions() {
node_save($new_node_revision);
$this->drupalGet("node/$node->nid");
$this->assertNoText($new_body, t('Revision body text is not present on default version of node.'));
$this->assertNoText($new_body, 'Revision body text is not present on default version of node.');
// Verify that the new body text is present on the revision.
$this->drupalGet("node/$node->nid/revisions/" . $new_node_revision->vid . "/view");
$this->assertText($new_body, t('Revision body text is present when loading specific revision.'));
$this->assertText($new_body, 'Revision body text is present when loading specific revision.');
// Verify that the non-default revision vid is greater than the default
// revision vid.
......@@ -164,9 +164,9 @@ function testNodeRevisionWithoutLogMessage() {
$node->save();
$this->drupalGet('node/' . $node->nid);
$this->assertText($new_title, t('New node title appears on the page.'));
$this->assertText($new_title, 'New node title appears on the page.');
$node_revision = node_load($node->nid, TRUE);
$this->assertEqual($node_revision->log, $log, t('After an existing node revision is re-saved without a log message, the original log message is preserved.'));
$this->assertEqual($node_revision->log, $log, 'After an existing node revision is re-saved without a log message, the original log message is preserved.');
// Create another node with an initial log message.
$node = $this->drupalCreateNode(array('log' => $log));
......
......@@ -64,10 +64,10 @@ function testImport() {
$node->save();
// Test the import.
$node_by_nid = node_load($test_nid);
$this->assertTrue($node_by_nid, t('Node load by node ID.'));
$this->assertTrue($node_by_nid, 'Node load by node ID.');
$node_by_title = $this->drupalGetNodeByTitle($title);
$this->assertTrue($node_by_title, t('Node load by node title.'));
$this->assertTrue($node_by_title, 'Node load by node title.');
}
/**
......@@ -84,8 +84,8 @@ function testTimestamps() {
entity_create('node', $edit)->save();
$node = $this->drupalGetNodeByTitle($edit['title']);
$this->assertEqual($node->created, REQUEST_TIME, t('Creating a node sets default "created" timestamp.'));
$this->assertEqual($node->changed, REQUEST_TIME, t('Creating a node sets default "changed" timestamp.'));
$this->assertEqual($node->created, REQUEST_TIME, 'Creating a node sets default "created" timestamp.');
$this->assertEqual($node->changed, REQUEST_TIME, 'Creating a node sets default "changed" timestamp.');
// Store the timestamps.
$created = $node->created;
......@@ -93,15 +93,15 @@ function testTimestamps() {
$node->save();
$node = $this->drupalGetNodeByTitle($edit['title'], TRUE);
$this->assertEqual($node->created, $created, t('Updating a node preserves "created" timestamp.'));
$this->assertEqual($node->created, $created, 'Updating a node preserves "created" timestamp.');
// Programmatically set the timestamps using hook_node_presave.
$node->title = 'testing_node_presave';
$node->save();
$node = $this->drupalGetNodeByTitle('testing_node_presave', TRUE);
$this->assertEqual($node->created, 280299600, t('Saving a node uses "created" timestamp set in presave hook.'));
$this->assertEqual($node->changed, 979534800, t('Saving a node uses "changed" timestamp set in presave hook.'));
$this->assertEqual($node->created, 280299600, 'Saving a node uses "created" timestamp set in presave hook.');
$this->assertEqual($node->changed, 979534800, 'Saving a node uses "changed" timestamp set in presave hook.');
// Programmatically set the timestamps on the node.
$edit = array(
......@@ -114,7 +114,7 @@ function testTimestamps() {
entity_create('node', $edit)->save();
$node = $this->drupalGetNodeByTitle($edit['title']);
$this->assertEqual($node->created, 280299600, t('Creating a node uses user-set "created" timestamp.'));
$this->assertEqual($node->created, 280299600, 'Creating a node uses user-set "created" timestamp.');
$this->assertNotEqual($node->changed, 979534800, t('Creating a node doesn\'t use user-set "changed" timestamp.'));
// Update the timestamps.
......@@ -123,7 +123,7 @@ function testTimestamps() {
$node->save();
$node = $this->drupalGetNodeByTitle($edit['title'], TRUE);
$this->assertEqual($node->created, 979534800, t('Updating a node uses user-set "created" timestamp.'));
$this->assertEqual($node->created, 979534800, 'Updating a node uses user-set "created" timestamp.');
$this->assertNotEqual($node->changed, 280299600, t('Updating a node doesn\'t use user-set "changed" timestamp.'));
}
......
......@@ -26,17 +26,17 @@ function testNodeTitleXSS() {
$edit = array("title" => $title);
$this->drupalPost('node/add/page', $edit, t('Preview'));
$this->assertNoRaw($xss, t('Harmful tags are escaped when previewing a node.'));
$this->assertNoRaw($xss, 'Harmful tags are escaped when previewing a node.');
$settings = array('title' => $title);
$node = $this->drupalCreateNode($settings);
$this->drupalGet('node/' . $node->nid);
// assertTitle() decodes HTML-entities inside the <title> element.
$this->assertTitle($edit["title"] . ' | Drupal', t('Title is diplayed when viewing a node.'));
$this->assertNoRaw($xss, t('Harmful tags are escaped when viewing a node.'));
$this->assertTitle($edit["title"] . ' | Drupal', 'Title is diplayed when viewing a node.');
$this->assertNoRaw($xss, 'Harmful tags are escaped when viewing a node.');
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertNoRaw($xss, t('Harmful tags are escaped when editing a node.'));
$this->assertNoRaw($xss, 'Harmful tags are escaped when editing a node.');
}
}
......@@ -63,7 +63,7 @@ function testNodeTokenReplacement() {
$tests['[node:changed:since]'] = format_interval(REQUEST_TIME - $node->changed, 2, $language_interface->langcode);
// Test to make sure that we generated something for each token.
$this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
$this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $node), array('langcode' => $language_interface->langcode));
......
......@@ -33,12 +33,12 @@ function testNodeTypeCustomizationPersistence() {
// disabled.
$this->drupalPost('admin/modules', $poll_enable, t('Save configuration'));
$disabled = db_query('SELECT disabled FROM {node_type} WHERE type = :type', array(':type' => 'poll'))->fetchField();
$this->assertNotIdentical($disabled, FALSE, t('Poll node type found in the database'));
$this->assertEqual($disabled, 0, t('Poll node type is not disabled'));