Пример #1
0
    public function testAllMethod()
    {
        $dump = <<<EOF
Filter: state = 0
Filter: state = 1
Filter: state != 2
Filter: state ~ 3
Filter: state !~ 4
Filter: state < 5
Filter: state > 6
Filter: state <= 7
Filter: state >= 8
And: 1
Or: 2
Negate:

EOF;
        $mock = new Filter();
        $mock->set('state = 0')->equal('state', '1')->notEqual('state', '2')->match('state', '3')->notMatch('state', '4')->less('state', '5')->greater('state', '6')->lessEqual('state', '7')->greaterEqual('state', '8')->operatorAnd(1)->operatorOr(2)->negate();
        $this->assertEquals($dump, join('', $mock->get()));
        $mock->reset();
        $this->assertEquals('', join('', $mock->get()));
    }
Пример #2
0
    public function testReadme9()
    {
        $lql = <<<EOF
GET hosts
Columns: host_name modified_attributes_list
ColumnHeaders: on
Filter: modified_attributes ~~ active_checks_enabled,passive_checks_enabled
OutputFormat: json
ResponseHeader: fixed16


EOF;
        $filter = new Filter();
        $filter->set('modified_attributes ~~ active_checks_enabled,passive_checks_enabled');
        $mock = \TestMock::on(new Lql(Table::HOSTS));
        $mock->column(new Column(array('host_name', 'modified_attributes_list')))->filter($filter);
        $this->assertEquals($lql, $mock->build(), 'Find hosts where active or passive checks have been tweaked.');
    }