2013-06-03 15:34:57 +02:00
|
|
|
<?php
|
|
|
|
namespace Tests\Icinga\Protocol\Statusdat;
|
2013-06-03 16:14:46 +02:00
|
|
|
require_once("../../library/Icinga/Protocol/Statusdat/IReader.php");
|
2013-07-22 13:47:09 +02:00
|
|
|
require_once(realpath("../../library/Icinga/Data/DatasourceInterface.php"));
|
|
|
|
use Icinga\Data\DatasourceInterface;
|
2013-06-03 15:34:57 +02:00
|
|
|
use Icinga\Protocol\Statusdat\IReader;
|
|
|
|
|
2013-07-22 13:47:09 +02:00
|
|
|
class ReaderMock implements IReader, DatasourceInterface
|
2013-06-03 15:34:57 +02:00
|
|
|
{
|
|
|
|
private $objects;
|
|
|
|
private $indices;
|
|
|
|
|
|
|
|
public function __construct(array $objects = array())
|
|
|
|
{
|
|
|
|
$this->objects = $objects;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getState()
|
|
|
|
{
|
2013-10-20 15:15:30 +02:00
|
|
|
return $this->objects;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getInternalState()
|
|
|
|
{
|
|
|
|
|
2013-06-03 15:34:57 +02:00
|
|
|
return array(
|
|
|
|
"objects" => $this->objects,
|
|
|
|
"indices" => $this->indices
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getObjects()
|
|
|
|
{
|
|
|
|
return $this->objects;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function __call($arg1,$arg2) {
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-07-22 13:47:09 +02:00
|
|
|
public function select()
|
|
|
|
{
|
|
|
|
return $this;
|
|
|
|
}
|
2013-06-03 15:34:57 +02:00
|
|
|
|
|
|
|
public function getObjectByName($type, $idx)
|
|
|
|
{
|
|
|
|
if (isset($this->objects[$type]) && isset($this->objects[$type][$idx]))
|
|
|
|
return $this->objects[$type][$idx];
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-06-03 16:14:46 +02:00
|
|
|
}
|