Johannes Meyer b74e264f01 Refactor comment command handling
- Refactored Comment class
- Dropped IComment interface
- Added AddCommentCommand class
- Updated CommentForm

refs #4580
2013-09-04 18:08:00 +02:00

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'));
}
}