From c47778f10e67f6fa021b2e2cc3c7bfa62796638b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 5 Sep 2013 14:49:37 +0200 Subject: [PATCH] Capitalize monitoring properties, e.g. Current Attempt --- .../views/helpers/MonitoringProperties.php | 22 +++++++-------- .../helpers/MonitoringPropertiesTest.php | 27 ++++++++++--------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/modules/monitoring/application/views/helpers/MonitoringProperties.php b/modules/monitoring/application/views/helpers/MonitoringProperties.php index cc929d336..b7f12ebc7 100644 --- a/modules/monitoring/application/views/helpers/MonitoringProperties.php +++ b/modules/monitoring/application/views/helpers/MonitoringProperties.php @@ -46,16 +46,16 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract * @var array */ private static $keys = array( - 'buildAttempt' => 'Current attempt', - 'last_check' => 'Last check time', - 'buildCheckType' => 'Check type', - 'buildLatency' => 'Check latency / duration', - 'buildNextCheck' => 'Next scheduled active check', - 'buildLastStateChange' => 'Last state change', - 'buildLastNotification' => 'Last notification', - 'buildFlapping' => 'Is this %s flapping?', - 'buildScheduledDowntime' => 'In scheduled downtime?', - 'status_update_time' => 'Last update' + 'buildAttempt' => 'Current Attempt', + 'last_check' => 'Last Check Time', + 'buildCheckType' => 'Check Type', + 'buildLatency' => 'Check Latency / Duration', + 'buildNextCheck' => 'Next Scheduled Active Check', + 'buildLastStateChange' => 'Last State Change', + 'buildLastNotification' => 'Last Notification', + 'buildFlapping' => 'Is This %s Flapping?', + 'buildScheduledDowntime' => 'In Scheduled Downtime?', + 'status_update_time' => 'Last Update' ); private static $notificationReasons = array( @@ -256,7 +256,7 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract $out = array(); foreach (self::$keys as $property => $label) { - $label = sprintf($label, $type); + $label = sprintf($label, ucfirst($type)); if (is_callable(array(&$this, $property))) { $out[$label] = $this->$property($object); } elseif (isset($object->{$property})) { diff --git a/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php b/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php index a1598d1be..3f7ff793d 100644 --- a/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php +++ b/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php @@ -6,6 +6,9 @@ require_once 'Zend/View/Helper/Abstract.php'; require_once 'Zend/View.php'; require_once __DIR__. '/../../../../../application/views/helpers/MonitoringProperties.php'; +/** + * @TODO(el): This test is subject to bug #4679 and + */ class HostStruct4Properties extends \stdClass { public $host_name = 'localhost'; @@ -70,8 +73,8 @@ class MonitoringPropertiesTest extends \PHPUnit_Framework_TestCase $items = $propertyHelper->monitoringProperties($host); $this->assertCount(10, $items); - $this->assertEquals('5/10 (HARD state)', $items['Current attempt']); - $this->assertEquals('2013-07-08 10:10:10', $items['Last update']); + $this->assertEquals('5/10 (HARD state)', $items['Current Attempt']); + $this->assertEquals('2013-07-08 10:10:10', $items['Last Update']); } public function testOutput2() @@ -89,16 +92,16 @@ class MonitoringPropertiesTest extends \PHPUnit_Framework_TestCase $this->assertCount(10, $items); $test = array( - 'Current attempt' => "5/10 (HARD state)", - 'Last check time' => "2013-07-04 11:24:42", - 'Check type' => "ACTIVE", - 'Check latency / duration' => "0.1204 / 0.0000 seconds", - 'Next scheduled active check' => "2013-07-04 11:29:43", - 'Last state change' => "2013-07-04 11:24:43", - 'Last notification' => "N/A (notification 0)", - 'Is this host flapping?' => "YES (12.37% state change)", - 'In scheduled downtime?' => "YES", - 'Last update' => "2013-07-08 10:10:10", + 'Current Attempt' => "5/10 (HARD state)", + 'Last Check Time' => "2013-07-04 11:24:42", + 'Check Type' => "ACTIVE", + 'Check Latency / Duration' => "0.1204 / 0.0000 seconds", + 'Next Scheduled Active Check' => "2013-07-04 11:29:43", + 'Last State Change' => "2013-07-04 11:24:43", + 'Last Notification' => "N/A (notification 0)", + 'Is This Host Flapping?' => "YES (12.37% state change)", + 'In Scheduled Downtime?' => "YES", + 'Last Update' => "2013-07-08 10:10:10", ); $this->assertEquals($test, $items);