Example #1
0
    public function testReadme16()
    {
        $lql = <<<EOF
GET services
Filter: host_groups >= windows
Filter: scheduled_downtime_depth = 0
Filter: host_scheduled_downtime_depth = 0
Filter: in_notification_period = 1
Stats: last_hard_state = 0
Stats: last_hard_state = 1
Stats: acknowledged = 0
StatsAnd: 2
Stats: last_hard_state = 1
Stats: acknowledged = 1
StatsAnd: 2
Stats: last_hard_state = 2
Stats: acknowledged = 0
StatsAnd: 2
Stats: last_hard_state = 2
Stats: acknowledged = 1
StatsAnd: 2
Stats: last_hard_state = 3
Stats: acknowledged = 0
StatsAnd: 2
Stats: last_hard_state = 3
Stats: acknowledged = 1
StatsAnd: 2
OutputFormat: json
ResponseHeader: fixed16


EOF;
        $stats = new Stats();
        $stats->equal('last_hard_state', '0')->equal('last_hard_state', '1')->equal('acknowledged', '0')->operatorAnd(2)->equal('last_hard_state', '1')->equal('acknowledged', '1')->operatorAnd(2)->equal('last_hard_state', '2')->equal('acknowledged', '0')->operatorAnd(2)->equal('last_hard_state', '2')->equal('acknowledged', '1')->operatorAnd(2)->equal('last_hard_state', '3')->equal('acknowledged', '0')->operatorAnd(2)->equal('last_hard_state', '3')->equal('acknowledged', '1')->operatorAnd(2);
        $filter = new Filter();
        $filter->greaterEqual('host_groups', 'windows')->equal('scheduled_downtime_depth', '0')->equal('host_scheduled_downtime_depth', '0')->equal('in_notification_period', '1');
        $mock = \TestMock::on(new Lql(Table::SERVICES));
        $mock->filter($filter)->stats($stats);
        $this->assertEquals($lql, $mock->build(), 'Combining with and/or.');
    }