isDue($now), 'PINGREQ became due too early'); } assertMqttKeepalive($keepalive->isDue(115), 'continuous inbound packets postponed the client PINGREQ'); $keepalive->markSent(115); assertMqttKeepalive(!$keepalive->isDue(129), 'PINGREQ repeated before its interval'); assertMqttKeepalive($keepalive->isDue(130), 'next PINGREQ was not scheduled'); $invalidIntervalRejected = false; try { new NiroMqttKeepalive(100, 0); } catch (InvalidArgumentException) { $invalidIntervalRejected = true; } assertMqttKeepalive($invalidIntervalRejected, 'invalid keepalive interval was accepted'); echo "NiroMqttKeepaliveTest passed\n";