mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-06-20 05:40:10 +02:00
- Refactored Comment class - Dropped IComment interface - Added AddCommentCommand class - Updated CommentForm refs #4580
34 lines
1.4 KiB
PHP
34 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\Icinga\Protocol\Commandpipe;
|
|
|
|
use Icinga\Protocol\Commandpipe\Comment;
|
|
use Icinga\Module\Monitoring\Command\AcknowledgeCommand;
|
|
|
|
require_once("../../library/Icinga/Protocol/Commandpipe/Comment.php");
|
|
require_once("../../library/Icinga/Protocol/Commandpipe/CommandType.php");
|
|
require_once("../../library/Icinga/Protocol/Commandpipe/CommandPipe.php");
|
|
require_once('../../modules/monitoring/library/Monitoring/Command/BaseCommand.php');
|
|
require_once('../../modules/monitoring/library/Monitoring/Command/AcknowledgeCommand.php');
|
|
|
|
class AcknowledgementTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
public function testAcknowledgeHostMessage()
|
|
{
|
|
$ack = new AcknowledgeCommand(new Comment("author", "commentdata"));
|
|
$this->assertEquals("ACKNOWLEDGE_HOST_PROBLEM;foo;0;0;0;author;commentdata", $ack->getHostCommand('foo'));
|
|
|
|
$ack->setExpire(1000);
|
|
$this->assertEquals("ACKNOWLEDGE_HOST_PROBLEM_EXPIRE;bar;0;0;0;1000;author;commentdata", $ack->getHostCommand('bar'));
|
|
}
|
|
|
|
public function testAcknowledgeServiceMessage()
|
|
{
|
|
$ack = new AcknowledgeCommand(new Comment("author", "commentdata"));
|
|
$this->assertEquals("ACKNOWLEDGE_SVC_PROBLEM;foo;bar;0;0;0;author;commentdata", $ack->getServiceCommand('foo', 'bar'));
|
|
|
|
$ack->setExpire(1000);
|
|
$this->assertEquals("ACKNOWLEDGE_SVC_PROBLEM_EXPIRE;bar;foo;0;0;0;1000;author;commentdata", $ack->getServiceCommand('bar', 'foo'));
|
|
}
|
|
}
|