diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-08-05 23:53:39 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-08-05 23:53:39 +0000 |
commit | 25171a17f626695ecf984cc44b60d3eae1310b4c (patch) | |
tree | 3268ef89294cbb96d0875d665012c4ff16d8c68a /modules/statistics | |
parent | cacd044a6398df92de68c5aea31987ac0fff507a (diff) | |
download | brdo-25171a17f626695ecf984cc44b60d3eae1310b4c.tar.gz brdo-25171a17f626695ecf984cc44b60d3eae1310b4c.tar.bz2 |
Reverting #500866. Needs more discussion.
Diffstat (limited to 'modules/statistics')
-rw-r--r-- | modules/statistics/statistics.test | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/modules/statistics/statistics.test b/modules/statistics/statistics.test index 89a136edc..31b13b95a 100644 --- a/modules/statistics/statistics.test +++ b/modules/statistics/statistics.test @@ -78,18 +78,18 @@ class StatisticsLoggingTestCase extends DrupalWebTestCase { // Verify logging of an uncached page. $this->drupalGet($path); - $this->assertIdentical($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Testing an uncached page.'); + $this->assertIdentical($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', t('Testing an uncached page.')); $log = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC); - $this->assertTrue(is_array($log) && count($log) == 1, 'Page request was logged.'); + $this->assertTrue(is_array($log) && count($log) == 1, t('Page request was logged.')); $this->assertEqual(array_intersect_key($log[0], $expected), $expected); $node_counter = statistics_get($this->node->nid); $this->assertIdentical($node_counter['totalcount'], '1'); // Verify logging of a cached page. $this->drupalGet($path); - $this->assertIdentical($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Testing a cached page.'); + $this->assertIdentical($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Testing a cached page.')); $log = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC); - $this->assertTrue(is_array($log) && count($log) == 2, 'Page request was logged.'); + $this->assertTrue(is_array($log) && count($log) == 2, t('Page request was logged.')); $this->assertEqual(array_intersect_key($log[1], $expected), $expected); $node_counter = statistics_get($this->node->nid); $this->assertIdentical($node_counter['totalcount'], '2'); @@ -113,9 +113,9 @@ class StatisticsReportsTestCase extends StatisticsTestCase { */ function testRecentHits() { $this->drupalGet('admin/reports/hits'); - $this->assertText('test', 'Hit title found.'); - $this->assertText('node/1', 'Hit URL found.'); - $this->assertText('Anonymous', 'Hit user found.'); + $this->assertText('test', t('Hit title found.')); + $this->assertText('node/1', t('Hit URL found.')); + $this->assertText('Anonymous', t('Hit user found.')); } /** @@ -123,8 +123,8 @@ class StatisticsReportsTestCase extends StatisticsTestCase { */ function testTopPages() { $this->drupalGet('admin/reports/pages'); - $this->assertText('test', 'Hit title found.'); - $this->assertText('node/1', 'Hit URL found.'); + $this->assertText('test', t('Hit title found.')); + $this->assertText('node/1', t('Hit URL found.')); } /** @@ -132,7 +132,7 @@ class StatisticsReportsTestCase extends StatisticsTestCase { */ function testTopReferrers() { $this->drupalGet('admin/reports/referrers'); - $this->assertText('http://example.com', 'Hit referrer found.'); + $this->assertText('http://example.com', t('Hit referrer found.')); } /** @@ -140,9 +140,9 @@ class StatisticsReportsTestCase extends StatisticsTestCase { */ function testDetails() { $this->drupalGet('admin/reports/access/1'); - $this->assertText('test', 'Hit title found.'); - $this->assertText('node/1', 'Hit URL found.'); - $this->assertText('Anonymous', 'Hit user found.'); + $this->assertText('test', t('Hit title found.')); + $this->assertText('node/1', t('Hit URL found.')); + $this->assertText('Anonymous', t('Hit user found.')); } /** @@ -151,8 +151,8 @@ class StatisticsReportsTestCase extends StatisticsTestCase { function testAccessLogging() { $this->drupalGet('admin/reports/referrers'); $this->drupalGet('admin/reports/hits'); - $this->assertText('Top referrers in the past 3 days', 'Hit title found.'); - $this->assertText('admin/reports/referrers', 'Hit URL found.'); + $this->assertText('Top referrers in the past 3 days', t('Hit title found.')); + $this->assertText('admin/reports/referrers', t('Hit URL found.')); } /** @@ -177,12 +177,12 @@ class StatisticsReportsTestCase extends StatisticsTestCase { // Get some page and check if the block is displayed. $this->drupalGet('user'); - $this->assertText('Popular content', 'Found the popular content block.'); - $this->assertText("Today's", 'Found today\'s popular content.'); - $this->assertText('All time', 'Found the alll time popular content.'); - $this->assertText('Last viewed', 'Found the last viewed popular content.'); + $this->assertText('Popular content', t('Found the popular content block.')); + $this->assertText("Today's", t('Found today\'s popular content.')); + $this->assertText('All time', t('Found the alll time popular content.')); + $this->assertText('Last viewed', t('Found the last viewed popular content.')); - $this->assertRaw(l($node->title, 'node/' . $node->nid), 'Found link to visited node.'); + $this->assertRaw(l($node->title, 'node/' . $node->nid), t('Found link to visited node.')); } } @@ -209,30 +209,30 @@ class StatisticsBlockVisitorsTestCase extends StatisticsTestCase { // and that a 'block IP address' link is displayed. $this->drupalLogin($this->blocking_user); $this->drupalGet('admin/reports/visitors'); - $this->assertText($test_ip_address, 'IP address found.'); - $this->assertText(t('block IP address'), 'Block IP link displayed'); + $this->assertText($test_ip_address, t('IP address found.')); + $this->assertText(t('block IP address'), t('Block IP link displayed')); // Block the IP address. $this->clickLink('block IP address'); - $this->assertText(t('IP address blocking'), 'IP blocking page displayed.'); + $this->assertText(t('IP address blocking'), t('IP blocking page displayed.')); $edit = array(); $edit['ip'] = $test_ip_address; $this->drupalPost('admin/config/people/ip-blocking', $edit, t('Add')); $ip = db_query("SELECT iid from {blocked_ips} WHERE ip = :ip", array(':ip' => $edit['ip']))->fetchField(); - $this->assertNotEqual($ip, FALSE, 'IP address found in database'); - $this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $edit['ip'])), 'IP address was blocked.'); + $this->assertNotEqual($ip, FALSE, t('IP address found in database')); + $this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $edit['ip'])), t('IP address was blocked.')); // Verify that the block/unblock link on the top visitors page has been // altered. $this->drupalGet('admin/reports/visitors'); - $this->assertText(t('unblock IP address'), 'Unblock IP address link displayed'); + $this->assertText(t('unblock IP address'), t('Unblock IP address link displayed')); // Unblock the IP address. $this->clickLink('unblock IP address'); - $this->assertRaw(t('Are you sure you want to delete %ip?', array('%ip' => $test_ip_address)), 'IP address deletion confirmation found.'); + $this->assertRaw(t('Are you sure you want to delete %ip?', array('%ip' => $test_ip_address)), t('IP address deletion confirmation found.')); $edit = array(); $this->drupalPost('admin/config/people/ip-blocking/delete/1', NULL, t('Delete')); - $this->assertRaw(t('The IP address %ip was deleted.', array('%ip' => $test_ip_address)), 'IP address deleted.'); + $this->assertRaw(t('The IP address %ip was deleted.', array('%ip' => $test_ip_address)), t('IP address deleted.')); } } @@ -262,32 +262,32 @@ class StatisticsAdminTestCase extends DrupalWebTestCase { * Verifies that the statistics settings page works. */ function testStatisticsSettings() { - $this->assertFalse(variable_get('statistics_enable_access_log', 0), 'Access log is disabled by default.'); - $this->assertFalse(variable_get('statistics_count_content_views', 0), 'Count content view log is disabled by default.'); + $this->assertFalse(variable_get('statistics_enable_access_log', 0), t('Access log is disabled by default.')); + $this->assertFalse(variable_get('statistics_count_content_views', 0), t('Count content view log is disabled by default.')); $this->drupalGet('admin/reports/pages'); - $this->assertRaw(t('No statistics available.'), 'Verifying text shown when no statistics is available.'); + $this->assertRaw(t('No statistics available.'), t('Verifying text shown when no statistics is available.')); // Enable access log and counter on content view. $edit['statistics_enable_access_log'] = 1; $edit['statistics_count_content_views'] = 1; $this->drupalPost('admin/config/system/statistics', $edit, t('Save configuration')); - $this->assertTrue(variable_get('statistics_enable_access_log'), 'Access log is enabled.'); - $this->assertTrue(variable_get('statistics_count_content_views'), 'Count content view log is enabled.'); + $this->assertTrue(variable_get('statistics_enable_access_log'), t('Access log is enabled.')); + $this->assertTrue(variable_get('statistics_count_content_views'), t('Count content view log is enabled.')); // Hit the node. $this->drupalGet('node/' . $this->test_node->nid); $this->drupalGet('admin/reports/pages'); - $this->assertText('node/1', 'Test node found.'); + $this->assertText('node/1', t('Test node found.')); // Hit the node again (the counter is incremented after the hit, so // "1 read" will actually be shown when the node is hit the second time). $this->drupalGet('node/' . $this->test_node->nid); - $this->assertText('1 read', 'Node is read once.'); + $this->assertText('1 read', t('Node is read once.')); $this->drupalGet('node/' . $this->test_node->nid); - $this->assertText('2 reads', 'Node is read 2 times.'); + $this->assertText('2 reads', t('Node is read 2 times.')); } /** @@ -336,10 +336,10 @@ class StatisticsAdminTestCase extends DrupalWebTestCase { $this->drupalPost(NULL, NULL, t('Cancel account')); // Confirm account cancellation request. $this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login)); - $this->assertFalse(user_load($account->uid, TRUE), 'User is not found in the database.'); + $this->assertFalse(user_load($account->uid, TRUE), t('User is not found in the database.')); $this->drupalGet('admin/reports/visitors'); - $this->assertNoText($account->name, 'Did not find user in visitor statistics.'); + $this->assertNoText($account->name, t('Did not find user in visitor statistics.')); } /** @@ -353,10 +353,10 @@ class StatisticsAdminTestCase extends DrupalWebTestCase { $this->drupalGet('node/' . $this->test_node->nid); $this->drupalGet('node/' . $this->test_node->nid); - $this->assertText('1 read', 'Node is read once.'); + $this->assertText('1 read', t('Node is read once.')); $this->drupalGet('admin/reports/pages'); - $this->assertText('node/' . $this->test_node->nid, 'Hit URL found.'); + $this->assertText('node/' . $this->test_node->nid, t('Hit URL found.')); // statistics_cron will subtract the statistics_flush_accesslog_timer // variable from REQUEST_TIME in the delete query, so wait two secs here to @@ -365,14 +365,14 @@ class StatisticsAdminTestCase extends DrupalWebTestCase { $this->cronRun(); $this->drupalGet('admin/reports/pages'); - $this->assertNoText('node/' . $this->test_node->nid, 'No hit URL found.'); + $this->assertNoText('node/' . $this->test_node->nid, t('No hit URL found.')); $result = db_select('node_counter', 'nc') ->fields('nc', array('daycount')) ->condition('nid', $this->test_node->nid, '=') ->execute() ->fetchField(); - $this->assertFalse($result, 'Daycounter is zero.'); + $this->assertFalse($result, t('Daycounter is zero.')); } } @@ -411,11 +411,11 @@ class StatisticsTokenReplaceTestCase extends StatisticsTestCase { $tests['[node:last-view:short]'] = format_date($statistics['timestamp'], 'short'); // Test to make sure that we generated something for each token. - $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); + $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.')); foreach ($tests as $input => $expected) { $output = token_replace($input, array('node' => $node), array('language' => $language)); - $this->assertFalse(strcmp($output, $expected), 'Statistics token ' . $input . ' replaced.'); + $this->assertFalse(strcmp($output, $expected), t('Statistics token %token replaced.', array('%token' => $input))); } } } |