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
ad7b2772a7
commit
dd5d0f619a
|
@ -84,7 +84,7 @@ class NodeAccessBaseTableTest extends NodeTestBase {
|
|||
$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 @@ class NodeAccessBaseTableTest extends NodeTestBase {
|
|||
}
|
||||
$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 @@ class NodeAccessLanguageTest extends NodeTestBase {
|
|||
// 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 @@ class NodeAccessRecordsTest extends NodeTestBase {
|
|||
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 @@ class NodeAccessRecordsTest extends NodeTestBase {
|
|||
// 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 @@ class NodeAdminTest extends NodeTestBase {
|
|||
$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 @@ class NodeAdminTest extends NodeTestBase {
|
|||
);
|
||||
$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 @@ class NodeAdminTest extends NodeTestBase {
|
|||
);
|
||||
$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 @@ class NodeAdminTest extends NodeTestBase {
|
|||
$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 @@ class NodeAdminTest extends NodeTestBase {
|
|||
$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 @@ class NodeBlockFunctionalTest extends NodeTestBase {
|
|||
'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 @@ class NodeBlockFunctionalTest extends NodeTestBase {
|
|||
'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 @@ class NodeBlockFunctionalTest extends NodeTestBase {
|
|||
// 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 @@ class NodeBlockFunctionalTest extends NodeTestBase {
|
|||
'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 @@ class NodeBlockFunctionalTest extends NodeTestBase {
|
|||
|
||||
// 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 @@ class NodeBlockFunctionalTest extends NodeTestBase {
|
|||
$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 @@ class NodeBlockTest extends NodeTestBase {
|
|||
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 @@ class NodeBuildContentTest extends NodeTestBase {
|
|||
$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 @@ class NodeCreationTest extends NodeTestBase {
|
|||
$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 @@ class NodeCreationTest extends NodeTestBase {
|
|||
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 @@ class NodeCreationTest extends NodeTestBase {
|
|||
$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 @@ class NodeFieldMultilingualTestCase extends WebTestBase {
|
|||
'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 @@ class NodeFieldMultilingualTestCase extends WebTestBase {
|
|||
|
||||
// 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 @@ class NodeFieldMultilingualTestCase extends WebTestBase {
|
|||
);
|
||||
$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 @@ class NodeFieldMultilingualTestCase extends WebTestBase {
|
|||
|
||||
// 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 @@ class NodeLoadMultipleTest extends NodeTestBase {
|
|||
|
||||
// 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 @@ class NodeLoadMultipleTest extends NodeTestBase {
|
|||
$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 @@ class NodePostSettingsTest extends NodeTestBase {
|
|||
// 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 @@ class NodePostSettingsTest extends NodeTestBase {
|
|||
|
||||
// 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 @@ class NodeQueryAlterTest extends NodeTestBase {
|
|||
$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 @@ class NodeQueryAlterTest extends NodeTestBase {
|
|||
$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 @@ class NodeQueryAlterTest extends NodeTestBase {
|
|||
$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 @@ class NodeQueryAlterTest extends NodeTestBase {
|
|||
$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 @@ class NodeQueryAlterTest extends NodeTestBase {
|
|||
$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 @@ class NodeRSSContentTest extends NodeTestBase {
|
|||
|
||||
// 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 @@ class NodeRSSContentTest extends NodeTestBase {
|
|||
'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 @@ class NodeRSSContentTest extends NodeTestBase {
|
|||
// 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 @@ class NodeRevisionsTest extends NodeTestBase {
|
|||
|
||||
// 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 @@ class NodeRevisionsTest extends NodeTestBase {
|
|||
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 @@ class NodeRevisionsTest extends NodeTestBase {
|
|||
$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 @@ class NodeRevisionsTest extends NodeTestBase {
|
|||
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 @@ class NodeRevisionsTest extends NodeTestBase {
|
|||
|
||||
$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 @@ class NodeSaveTest extends NodeTestBase {
|
|||
$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 @@ class NodeSaveTest extends NodeTestBase {
|
|||
|
||||
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 @@ class NodeSaveTest extends NodeTestBase {
|
|||
|
||||
$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 @@ class NodeSaveTest extends NodeTestBase {
|
|||
|
||||
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 @@ class NodeSaveTest extends NodeTestBase {
|
|||
|
||||
$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 @@ class NodeTitleXSSTest extends NodeTestBase {
|
|||
$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 @@ class NodeTokenReplaceTest extends NodeTestBase {
|
|||
$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 @@ class NodeTypePersistenceTest extends NodeTestBase {
|
|||
// 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'));
|
||||
$this->assertNotIdentical($disabled, FALSE, 'Poll node type found in the database');
|
||||
$this->assertEqual($disabled, 0, 'Poll node type is not disabled');
|
||||
|
||||
// Check that poll node type (uncustomized) shows up.
|
||||
$this->drupalGet('node/add');
|
||||
$this->assertText('poll', t('poll type is found on node/add'));
|
||||
$this->assertText('poll', 'poll type is found on node/add');
|
||||
|
||||
// Customize poll description.
|
||||
$description = $this->randomName();
|
||||
|
@ -47,23 +47,23 @@ class NodeTypePersistenceTest extends NodeTestBase {
|
|||
|
||||
// Check that poll node type customization shows up.
|
||||
$this->drupalGet('node/add');
|
||||
$this->assertText($description, t('Customized description found'));
|
||||
$this->assertText($description, 'Customized description found');
|
||||
|
||||
// Disable poll and check that the node type gets disabled.
|
||||
$this->drupalPost('admin/modules', $poll_disable, t('Save configuration'));
|
||||
$disabled = db_query('SELECT disabled FROM {node_type} WHERE type = :type', array(':type' => 'poll'))->fetchField();
|
||||
$this->assertEqual($disabled, 1, t('Poll node type is disabled'));
|
||||
$this->assertEqual($disabled, 1, 'Poll node type is disabled');
|
||||
$this->drupalGet('node/add');
|
||||
$this->assertNoText('poll', t('poll type is not found on node/add'));
|
||||
$this->assertNoText('poll', 'poll type is not found on node/add');
|
||||
|
||||
// Reenable poll and check that the customization survived the module
|
||||
// disable.
|
||||
$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'));
|
||||
$this->assertNotIdentical($disabled, FALSE, 'Poll node type found in the database');
|
||||
$this->assertEqual($disabled, 0, 'Poll node type is not disabled');
|
||||
$this->drupalGet('node/add');
|
||||
$this->assertText($description, t('Customized description found'));
|
||||
$this->assertText($description, 'Customized description found');
|
||||
|
||||
// Disable and uninstall poll.
|
||||
$this->drupalPost('admin/modules', $poll_disable, t('Save configuration'));
|
||||
|
@ -71,14 +71,14 @@ class NodeTypePersistenceTest extends NodeTestBase {
|
|||
$this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
|
||||
$this->drupalPost(NULL, array(), t('Uninstall'));
|
||||
$disabled = db_query('SELECT disabled FROM {node_type} WHERE type = :type', array(':type' => 'poll'))->fetchField();
|
||||
$this->assertTrue($disabled, t('Poll node type is in the database and is disabled'));
|
||||
$this->assertTrue($disabled, 'Poll node type is in the database and is disabled');
|
||||
$this->drupalGet('node/add');
|
||||
$this->assertNoText('poll', t('poll type is no longer found on node/add'));
|
||||
$this->assertNoText('poll', 'poll type is no longer found on node/add');
|
||||
|
||||
// Reenable poll and check that the customization survived the module
|
||||
// uninstall.
|
||||
$this->drupalPost('admin/modules', $poll_enable, t('Save configuration'));
|
||||
$this->drupalGet('node/add');
|
||||
$this->assertText($description, t('Customized description is found even after uninstall and reenable.'));
|
||||
$this->assertText($description, 'Customized description is found even after uninstall and reenable.');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,14 +36,14 @@ class NodeTypeTest extends NodeTestBase {
|
|||
$node_types = node_type_get_types();
|
||||
$node_names = node_type_get_names();
|
||||
|
||||
$this->assertTrue(isset($node_types['article']), t('Node type article is available.'));
|
||||
$this->assertTrue(isset($node_types['page']), t('Node type basic page is available.'));
|
||||
$this->assertTrue(isset($node_types['article']), 'Node type article is available.');
|
||||
$this->assertTrue(isset($node_types['page']), 'Node type basic page is available.');
|
||||
|
||||
$this->assertEqual($node_types['article']->name, $node_names['article'], t('Correct node type base has been returned.'));
|
||||
$this->assertEqual($node_types['article']->name, $node_names['article'], 'Correct node type base has been returned.');
|
||||
|
||||
$this->assertEqual($node_types['article'], node_type_load('article'), t('Correct node type has been returned.'));
|
||||
$this->assertEqual($node_types['article']->name, node_type_get_label('article'), t('Correct node type name has been returned.'));
|
||||
$this->assertEqual($node_types['page']->base, node_type_get_base('page'), t('Correct node type base has been returned.'));
|
||||
$this->assertEqual($node_types['article'], node_type_load('article'), 'Correct node type has been returned.');
|
||||
$this->assertEqual($node_types['article']->name, node_type_get_label('article'), 'Correct node type name has been returned.');
|
||||
$this->assertEqual($node_types['page']->base, node_type_get_base('page'), 'Correct node type base has been returned.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,12 +84,12 @@ class NodeTypeTest extends NodeTestBase {
|
|||
$this->drupalLogin($web_user);
|
||||
|
||||
$instance = field_info_instance('node', 'body', 'page');
|
||||
$this->assertEqual($instance['label'], 'Body', t('Body field was found.'));
|
||||
$this->assertEqual($instance['label'], 'Body', 'Body field was found.');
|
||||
|
||||
// Verify that title and body fields are displayed.
|
||||
$this->drupalGet('node/add/page');
|
||||
$this->assertRaw('Title', t('Title field was found.'));
|
||||
$this->assertRaw('Body', t('Body field was found.'));
|
||||
$this->assertRaw('Title', 'Title field was found.');
|
||||
$this->assertRaw('Body', 'Body field was found.');
|
||||
|
||||
// Rename the title field.
|
||||
$edit = array(
|
||||
|
@ -100,8 +100,8 @@ class NodeTypeTest extends NodeTestBase {
|
|||
field_info_cache_clear();
|
||||
|
||||
$this->drupalGet('node/add/page');
|
||||
$this->assertRaw('Foo', t('New title label was displayed.'));
|
||||
$this->assertNoRaw('Title', t('Old title label was not displayed.'));
|
||||
$this->assertRaw('Foo', 'New title label was displayed.');
|
||||
$this->assertNoRaw('Title', 'Old title label was not displayed.');
|
||||
|
||||
// Change the name, machine name and description.
|
||||
$edit = array(
|
||||
|
@ -113,12 +113,12 @@ class NodeTypeTest extends NodeTestBase {
|
|||
field_info_cache_clear();
|
||||
|
||||
$this->drupalGet('node/add');
|
||||
$this->assertRaw('Bar', t('New name was displayed.'));
|
||||
$this->assertRaw('Lorem ipsum', t('New description was displayed.'));
|
||||
$this->assertRaw('Bar', 'New name was displayed.');
|
||||
$this->assertRaw('Lorem ipsum', 'New description was displayed.');
|
||||
$this->clickLink('Bar');
|
||||
$this->assertEqual(url('node/add/bar', array('absolute' => TRUE)), $this->getUrl(), t('New machine name was used in URL.'));
|
||||
$this->assertRaw('Foo', t('Title field was found.'));
|
||||
$this->assertRaw('Body', t('Body field was found.'));
|
||||
$this->assertEqual(url('node/add/bar', array('absolute' => TRUE)), $this->getUrl(), 'New machine name was used in URL.');
|
||||
$this->assertRaw('Foo', 'Title field was found.');
|
||||
$this->assertRaw('Body', 'Body field was found.');
|
||||
|
||||
// Remove the body field.
|
||||
$this->drupalPost('admin/structure/types/manage/bar/fields/body/delete', array(), t('Delete'));
|
||||
|
@ -126,7 +126,7 @@ class NodeTypeTest extends NodeTestBase {
|
|||
$this->drupalPost('admin/structure/types/manage/bar', array(), t('Save content type'));
|
||||
// Check that the body field doesn't exist.
|
||||
$this->drupalGet('node/add/bar');
|
||||
$this->assertNoRaw('Body', t('Body field was not found.'));
|
||||
$this->assertNoRaw('Body', 'Body field was not found.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,20 +43,20 @@ class PageEditTest extends NodeTestBase {
|
|||
|
||||
// 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 that "edit" link points to correct page.
|
||||
$this->clickLink(t('Edit'));
|
||||
$edit_url = url("node/$node->nid/edit", array('absolute' => TRUE));
|
||||
$actual_url = $this->getURL();
|
||||
$this->assertEqual($edit_url, $actual_url, t('On edit page.'));
|
||||
$this->assertEqual($edit_url, $actual_url, 'On edit page.');
|
||||
|
||||
// Check that the title and body fields are displayed with the correct values.
|
||||
$active = '<span class="element-invisible">' . t('(active tab)') . '</span>';
|
||||
$link_text = t('!local-task-title!active', array('!local-task-title' => t('Edit'), '!active' => $active));
|
||||
$this->assertText(strip_tags($link_text), 0, t('Edit tab found and marked active.'));
|
||||
$this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.'));
|
||||
$this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.'));
|
||||
$this->assertText(strip_tags($link_text), 0, 'Edit tab found and marked active.');
|
||||
$this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
|
||||
$this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
|
||||
|
||||
// Edit the content of the node.
|
||||
$edit = array();
|
||||
|
@ -66,8 +66,8 @@ class PageEditTest extends NodeTestBase {
|
|||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
|
||||
// Check that the title and body fields are displayed with the updated values.
|
||||
$this->assertText($edit[$title_key], t('Title displayed.'));
|
||||
$this->assertText($edit[$body_key], t('Body displayed.'));
|
||||
$this->assertText($edit[$title_key], 'Title displayed.');
|
||||
$this->assertText($edit[$body_key], 'Body displayed.');
|
||||
|
||||
// Login as a second administrator user.
|
||||
$second_web_user = $this->drupalCreateUser(array('administer nodes', 'edit any page content'));
|
||||
|
|
|
@ -38,13 +38,13 @@ class PagePreviewTest extends NodeTestBase {
|
|||
$this->drupalPost('node/add/page', $edit, t('Preview'));
|
||||
|
||||
// Check that the preview is displaying the title and body.
|
||||
$this->assertTitle(t('Preview | Drupal'), t('Basic page title is preview.'));
|
||||
$this->assertText($edit[$title_key], t('Title displayed.'));
|
||||
$this->assertText($edit[$body_key], t('Body displayed.'));
|
||||
$this->assertTitle(t('Preview | Drupal'), 'Basic page title is preview.');
|
||||
$this->assertText($edit[$title_key], 'Title displayed.');
|
||||
$this->assertText($edit[$body_key], 'Body displayed.');
|
||||
|
||||
// Check that the title and body fields are displayed with the correct values.
|
||||
$this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.'));
|
||||
$this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.'));
|
||||
$this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
|
||||
$this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,15 +65,15 @@ class PagePreviewTest extends NodeTestBase {
|
|||
$this->drupalPost('node/add/page', $edit, t('Preview'));
|
||||
|
||||
// Check that the preview is displaying the title and body.
|
||||
$this->assertTitle(t('Preview | Drupal'), t('Basic page title is preview.'));
|
||||
$this->assertText($edit[$title_key], t('Title displayed.'));
|
||||
$this->assertText($edit[$body_key], t('Body displayed.'));
|
||||
$this->assertTitle(t('Preview | Drupal'), 'Basic page title is preview.');
|
||||
$this->assertText($edit[$title_key], 'Title displayed.');
|
||||
$this->assertText($edit[$body_key], 'Body displayed.');
|
||||
|
||||
// Check that the title and body fields are displayed with the correct values.
|
||||
$this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.'));
|
||||
$this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.'));
|
||||
$this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
|
||||
$this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
|
||||
|
||||
// Check that the log field has the correct value.
|
||||
$this->assertFieldByName('log', $edit['log'], t('Log field displayed.'));
|
||||
$this->assertFieldByName('log', $edit['log'], 'Log field displayed.');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ class PageViewTest extends NodeTestBase {
|
|||
function testPageView() {
|
||||
// Create a node to view.
|
||||
$node = $this->drupalCreateNode();
|
||||
$this->assertTrue(node_load($node->nid), t('Node created.'));
|
||||
$this->assertTrue(node_load($node->nid), 'Node created.');
|
||||
|
||||
// Try to edit with anonymous user.
|
||||
$html = $this->drupalGet("node/$node->nid/edit");
|
||||
|
|
|
@ -26,7 +26,7 @@ class SummaryLengthTest extends NodeTestBase {
|
|||
'promote' => 1,
|
||||
);
|
||||
$node = $this->drupalCreateNode($settings);
|
||||
$this->assertTrue(node_load($node->nid), t('Node created.'));
|
||||
$this->assertTrue(node_load($node->nid), 'Node created.');
|
||||
|
||||
// Create user with permission to view the node.
|
||||
$web_user = $this->drupalCreateUser(array('access content', 'administer content types'));
|
||||
|
|
Loading…
Reference in New Issue