| @@ 58-82 (lines=25) @@ | ||
| 55 | ); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function testReadme3() |
|
| 59 | { |
|
| 60 | $lql = <<<EOF |
|
| 61 | GET services |
|
| 62 | Columns: host_name description state |
|
| 63 | ColumnHeaders: on |
|
| 64 | Filter: state = 2 |
|
| 65 | OutputFormat: json |
|
| 66 | ResponseHeader: fixed16 |
|
| 67 | ||
| 68 | ||
| 69 | EOF; |
|
| 70 | ||
| 71 | $mock = \TestMock::on( |
|
| 72 | new LqlBuilder(Table::SERVICES) |
|
| 73 | ); |
|
| 74 | $mock->columns(array('host_name', 'description', 'state')) |
|
| 75 | ->filterEqual('state', '2'); |
|
| 76 | ||
| 77 | $this->assertEquals( |
|
| 78 | $lql, |
|
| 79 | $mock->build(), |
|
| 80 | 'Gets all services with the current state 2 (critical).' |
|
| 81 | ); |
|
| 82 | } |
|
| 83 | ||
| 84 | public function testReadme4() |
|
| 85 | { |
|
| @@ 84-110 (lines=27) @@ | ||
| 81 | ); |
|
| 82 | } |
|
| 83 | ||
| 84 | public function testReadme4() |
|
| 85 | { |
|
| 86 | $lql = <<<EOF |
|
| 87 | GET services |
|
| 88 | Columns: host_name description state |
|
| 89 | ColumnHeaders: on |
|
| 90 | Filter: state = 2 |
|
| 91 | Filter: in_notification_period = 1 |
|
| 92 | OutputFormat: json |
|
| 93 | ResponseHeader: fixed16 |
|
| 94 | ||
| 95 | ||
| 96 | EOF; |
|
| 97 | ||
| 98 | $mock = \TestMock::on( |
|
| 99 | new LqlBuilder(Table::SERVICES) |
|
| 100 | ); |
|
| 101 | $mock->columns(array('host_name', 'description', 'state')) |
|
| 102 | ->filterEqual('state', '2') |
|
| 103 | ->filterEqual('in_notification_period', '1'); |
|
| 104 | ||
| 105 | $this->assertEquals( |
|
| 106 | $lql, |
|
| 107 | $mock->build(), |
|
| 108 | 'Gets all critical services which are currently within their notification period.' |
|
| 109 | ); |
|
| 110 | } |
|
| 111 | } |
|
| 112 | ||