Commit 24b70a28 authored by Dries's avatar Dries

Issue #1741338 by lazysoundsystem: Removing t() from asserts in simpletests in block module.

parent 1f0e35dc
......@@ -64,20 +64,20 @@ function testCachePerRole() {
variable_set('block_test_content', $current_content);
$this->drupalLogin($this->normal_user);
$this->drupalGet('');
$this->assertText($current_content, t('Block content displays.'));
$this->assertText($current_content, 'Block content displays.');
// Change the content, but the cached copy should still be served.
$old_content = $current_content;
$current_content = $this->randomName();
variable_set('block_test_content', $current_content);
$this->drupalGet('');
$this->assertText($old_content, t('Block is served from the cache.'));
$this->assertText($old_content, 'Block is served from the cache.');
// Clear the cache and verify that the stale data is no longer there.
cache_invalidate(array('content' => TRUE));
$this->drupalGet('');
$this->assertNoText($old_content, t('Block cache clear removes stale cache data.'));
$this->assertText($current_content, t('Fresh block content is displayed after clearing the cache.'));
$this->assertNoText($old_content, 'Block cache clear removes stale cache data.');
$this->assertText($current_content, 'Fresh block content is displayed after clearing the cache.');
// Test whether the cached data is served for the correct users.
$old_content = $current_content;
......@@ -85,19 +85,19 @@ function testCachePerRole() {
variable_set('block_test_content', $current_content);
$this->drupalLogout();
$this->drupalGet('');
$this->assertNoText($old_content, t('Anonymous user does not see content cached per-role for normal user.'));
$this->assertNoText($old_content, 'Anonymous user does not see content cached per-role for normal user.');
$this->drupalLogin($this->normal_user_alt);
$this->drupalGet('');
$this->assertText($old_content, t('User with the same roles sees per-role cached content.'));
$this->assertText($old_content, 'User with the same roles sees per-role cached content.');
$this->drupalLogin($this->admin_user);
$this->drupalGet('');
$this->assertNoText($old_content, t('Admin user does not see content cached per-role for normal user.'));
$this->assertNoText($old_content, 'Admin user does not see content cached per-role for normal user.');
$this->drupalLogin($this->normal_user);
$this->drupalGet('');
$this->assertText($old_content, t('Block is served from the per-role cache.'));
$this->assertText($old_content, 'Block is served from the per-role cache.');
}
/**
......@@ -109,7 +109,7 @@ function testCacheGlobal() {
variable_set('block_test_content', $current_content);
$this->drupalGet('');
$this->assertText($current_content, t('Block content displays.'));
$this->assertText($current_content, 'Block content displays.');
$old_content = $current_content;
$current_content = $this->randomName();
......@@ -117,7 +117,7 @@ function testCacheGlobal() {
$this->drupalLogout();
$this->drupalGet('user');
$this->assertText($old_content, t('Block content served from global cache.'));
$this->assertText($old_content, 'Block content served from global cache.');
}
/**
......@@ -130,13 +130,13 @@ function testNoCache() {
// If DRUPAL_NO_CACHE has no effect, the next request would be cached.
$this->drupalGet('');
$this->assertText($current_content, t('Block content displays.'));
$this->assertText($current_content, 'Block content displays.');
// A cached copy should not be served.
$current_content = $this->randomName();
variable_set('block_test_content', $current_content);
$this->drupalGet('');
$this->assertText($current_content, t('DRUPAL_NO_CACHE prevents blocks from being cached.'));
$this->assertText($current_content, 'DRUPAL_NO_CACHE prevents blocks from being cached.');
}
/**
......@@ -149,22 +149,22 @@ function testCachePerUser() {
$this->drupalLogin($this->normal_user);
$this->drupalGet('');
$this->assertText($current_content, t('Block content displays.'));
$this->assertText($current_content, 'Block content displays.');
$old_content = $current_content;
$current_content = $this->randomName();
variable_set('block_test_content', $current_content);
$this->drupalGet('');
$this->assertText($old_content, t('Block is served from per-user cache.'));
$this->assertText($old_content, 'Block is served from per-user cache.');
$this->drupalLogin($this->normal_user_alt);
$this->drupalGet('');
$this->assertText($current_content, t('Per-user block cache is not served for other users.'));
$this->assertText($current_content, 'Per-user block cache is not served for other users.');
$this->drupalLogin($this->normal_user);
$this->drupalGet('');
$this->assertText($old_content, t('Per-user block cache is persistent.'));
$this->assertText($old_content, 'Per-user block cache is persistent.');
}
/**
......@@ -176,16 +176,16 @@ function testCachePerPage() {
variable_set('block_test_content', $current_content);
$this->drupalGet('node');
$this->assertText($current_content, t('Block content displays on the node page.'));
$this->assertText($current_content, 'Block content displays on the node page.');
$old_content = $current_content;
$current_content = $this->randomName();
variable_set('block_test_content', $current_content);
$this->drupalGet('user');
$this->assertNoText($old_content, t('Block content cached for the node page does not show up for the user page.'));
$this->assertNoText($old_content, 'Block content cached for the node page does not show up for the user page.');
$this->drupalGet('node');
$this->assertText($old_content, t('Block content cached for the node page.'));
$this->assertText($old_content, 'Block content cached for the node page.');
}
/**
......
......@@ -59,7 +59,7 @@ function testBlockNotInHiddenRegion() {
// Ensure that the search form block is displayed.
$this->drupalGet('');
$this->assertText('Search', t('Block was displayed on the front page.'));
$this->assertText('Search', 'Block was displayed on the front page.');
// Enable "block_test_theme" and set it as the default theme.
$theme = 'block_test_theme';
......@@ -69,10 +69,10 @@ function testBlockNotInHiddenRegion() {
// Ensure that "block_test_theme" is set as the default theme.
$this->drupalGet('admin/structure/block');
$this->assertText('Block test theme(' . t('active tab') . ')', t('Default local task on blocks admin page is the block test theme.'));
$this->assertText('Block test theme(' . t('active tab') . ')', 'Default local task on blocks admin page is the block test theme.');
// Ensure that the search form block is displayed.
$this->drupalGet('');
$this->assertText('Search', t('Block was displayed on the front page.'));
$this->assertText('Search', 'Block was displayed on the front page.');
}
}
......@@ -50,6 +50,6 @@ function setUp() {
*/
function testHtmlId() {
$this->drupalGet('');
$this->assertRaw('block-block-test-test-html-id', t('HTML id for test block is valid.'));
$this->assertRaw('block-block-test-test-html-id', 'HTML id for test block is valid.');
}
}
......@@ -44,11 +44,11 @@ public function testLanguageBlockVisibility() {
'predefined_langcode' => 'fr',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
$this->assertText('French', t('Language added successfully.'));
$this->assertText('French', 'Language added successfully.');
// Check if the visibility setting is available.
$this->drupalGet('admin/structure/block/add');
$this->assertField('langcodes[en]', t('Language visibility field is visible.'));
$this->assertField('langcodes[en]', 'Language visibility field is visible.');
// Create a new block.
$info_name = $this->randomString(10);
......@@ -81,11 +81,11 @@ public function testLanguageBlockVisibility() {
// Check that a page has a block
$this->drupalGet('', array('language' => language_load('en')));
$this->assertText($body, t('The body of the custom block appears on the page.'));
$this->assertText($body, 'The body of the custom block appears on the page.');
// Check that a page doesn't has a block for the current language anymore
$this->drupalGet('', array('language' => language_load('fr')));
$this->assertNoText($body, t('The body of the custom block does not appear on the page.'));
$this->assertNoText($body, 'The body of the custom block does not appear on the page.');
}
/**
......@@ -103,7 +103,7 @@ public function testLanguageBlockVisibilityLanguageDelete() {
'predefined_langcode' => 'fr',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
$this->assertText('French', t('Language added successfully.'));
$this->assertText('French', 'Language added successfully.');
// Create a new block.
$info_name = $this->randomString(10);
......@@ -130,7 +130,7 @@ public function testLanguageBlockVisibilityLanguageDelete() {
':module' => 'block',
':delta' => '1'
))->fetchField();
$this->assertTrue($count == 1, t('The block language visibility has an entry in the database.'));
$this->assertTrue($count == 1, 'The block language visibility has an entry in the database.');
// Delete the language.
$this->drupalPost('admin/config/regional/language/delete/fr', array(), t('Delete'));
......@@ -140,7 +140,7 @@ public function testLanguageBlockVisibilityLanguageDelete() {
':module' => 'block',
':delta' => '1'
))->fetchField();
$this->assertTrue($count == 0, t('The block language visibility do not have an entry in the database.'));
$this->assertTrue($count == 0, 'The block language visibility do not have an entry in the database.');
}
/**
......@@ -158,7 +158,7 @@ public function testLanguageBlockVisibilityBlockDelete() {
'predefined_langcode' => 'fr',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
$this->assertText('French', t('Language added successfully.'));
$this->assertText('French', 'Language added successfully.');
// Create a new block.
$info_name = $this->randomString(10);
......@@ -185,7 +185,7 @@ public function testLanguageBlockVisibilityBlockDelete() {
':module' => 'block',
':delta' => '1'
))->fetchField();
$this->assertTrue($count == 1, t('The block language visibility has an entry in the database.'));
$this->assertTrue($count == 1, 'The block language visibility has an entry in the database.');
// Delete the custom block.
$this->drupalPost('admin/structure/block/manage/block/1/delete', array(), t('Delete'));
......@@ -195,6 +195,6 @@ public function testLanguageBlockVisibilityBlockDelete() {
':module' => 'block',
':delta' => '1'
))->fetchField();
$this->assertTrue($count == 0, t('The block language visibility do not have an entry in the database.'));
$this->assertTrue($count == 0, 'The block language visibility do not have an entry in the database.');
}
}
......@@ -35,7 +35,7 @@ function testBlockThemeHookSuggestions() {
$variables1['elements']['#block'] = $block1;
$variables1['elements']['#children'] = '';
template_preprocess_block($variables1);
$this->assertEqual($variables1['theme_hook_suggestions'], array('block__footer', 'block__block', 'block__block__underscore_test'), t('Found expected block suggestions for delta with underscore'));
$this->assertEqual($variables1['theme_hook_suggestions'], array('block__footer', 'block__block', 'block__block__underscore_test'), 'Found expected block suggestions for delta with underscore');
// Define block delta with hyphens to be preprocessed. Hyphens should be
// replaced with underscores.
......@@ -49,8 +49,8 @@ function testBlockThemeHookSuggestions() {
// Test adding a class to the block content.
$variables2['content_attributes']['class'][] = 'test-class';
template_preprocess_block($variables2);
$this->assertEqual($variables2['theme_hook_suggestions'], array('block__footer', 'block__block', 'block__block__hyphen_test'), t('Hyphens (-) in block delta were replaced by underscore (_)'));
$this->assertEqual($variables2['theme_hook_suggestions'], array('block__footer', 'block__block', 'block__block__hyphen_test'), 'Hyphens (-) in block delta were replaced by underscore (_)');
// Test that the default class and added class are available.
$this->assertEqual($variables2['content_attributes']['class'], array('test-class', 'content'), t('Default .content class added to block content_attributes_array'));
$this->assertEqual($variables2['content_attributes']['class'], array('test-class', 'content'), 'Default .content class added to block content_attributes_array');
}
}
......@@ -44,7 +44,7 @@ function testNewDefaultThemeBlocks() {
$themes['admin'] = $admin_theme;
}
$count = db_query_range('SELECT 1 FROM {block} WHERE theme NOT IN (:themes)', 0, 1, array(':themes' => $themes))->fetchField();
$this->assertFalse($count, t('Only the default theme and the admin theme have blocks.'));
$this->assertFalse($count, 'Only the default theme and the admin theme have blocks.');
// Populate list of all blocks for matching against new theme.
$blocks = array();
......@@ -63,7 +63,7 @@ function testNewDefaultThemeBlocks() {
$result = db_query('SELECT * FROM {block} WHERE theme = :theme', array(':theme' => $new_theme));
foreach ($result as $block) {
unset($block->theme, $block->bid);
$this->assertEqual($blocks[$block->module][$block->delta], $block, t('Block %name matched', array('%name' => $block->module . '-' . $block->delta)));
$this->assertEqual($blocks[$block->module][$block->delta], $block, format_string('Block %name matched', array('%name' => $block->module . '-' . $block->delta)));
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment