From 9b47fdc56dc7f5ca75e221fdbe48fc47225eb5c3 Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Sat, 20 Oct 2018 09:23:16 +0200 Subject: [PATCH] fix(mqtthandler): message format mismatch with mdm agent Signed-off-by: Thierry Bugier --- inc/mqtthandler.class.php | 4 ++-- tests/suite-integration/PluginFlyvemdmAgent.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/mqtthandler.class.php b/inc/mqtthandler.class.php index 5d967835..bf1aa597 100644 --- a/inc/mqtthandler.class.php +++ b/inc/mqtthandler.class.php @@ -360,9 +360,9 @@ protected function updateOnlineStatus($topic, $message) { if (!isset($feedback['online'])) { return; } - if ($feedback['online'] == 'false') { + if ($feedback['online'] == false) { $status = '0'; - } else if ($feedback['online'] == 'true') { + } else if ($feedback['online'] == true) { $status = '1'; } else { // Invalid value diff --git a/tests/suite-integration/PluginFlyvemdmAgent.php b/tests/suite-integration/PluginFlyvemdmAgent.php index 92a55cd7..8f20294a 100644 --- a/tests/suite-integration/PluginFlyvemdmAgent.php +++ b/tests/suite-integration/PluginFlyvemdmAgent.php @@ -450,9 +450,9 @@ public function testDeviceOnlineChange() { $this->boolean($agent->isNewItem()) ->isFalse(json_encode($_SESSION['MESSAGE_AFTER_REDIRECT'], JSON_PRETTY_PRINT)); - $this->deviceOnlineStatus($agent, 'true', 1); + $this->deviceOnlineStatus($agent, true, 1); - $this->deviceOnlineStatus($agent, 'false', 0); + $this->deviceOnlineStatus($agent, false, 0); } /**