converter = new C52EventNameConverter(); } protected function tearDown(): void { $this->converter = null; } public function simpleProviderData() { return [ [ 'String containing expression macro {?{host:item.last()} = 0}.', 'String containing expression macro {?last(/host/item) = 0}.' ], [ 'String containing expression macro {?{host:item[{#M}].last()} = 0}.', 'String containing expression macro {?last(/host/item[{#M}]) = 0}.' ], [ 'String containing expression macro {?{{HOST.HOST}:item.func(1)} = 0}.', 'String containing expression macro {?func(//item,"1") = 0}.' ], [ 'String containing expression macro '. '{{?100*'. '{Zabbux Server:system.cpu.load.trendavg(1M,now/M)}'. '/'. '{Zabbux Server:system.cpu.load.trendavg(1M,now/M-1M)}'. '}.fmtnum(0)}'. '%', 'String containing expression macro {{?100*'. 'trendavg(/Zabbux Server/system.cpu.load,1M:now/M)'. '/'. 'trendavg(/Zabbux Server/system.cpu.load,1M:now/M-1M)'. '}.fmtnum(0)}%' ], [ 'String containing expression macro {?{host:item.date()}}=1 and {?{host:item.date()}}.', 'String containing expression macro {?date()}=1 and {?date()}.' ], [ 'String containing expression macro {?{host:item.date()}}=1.', 'String containing expression macro {?date()}=1.' ], [ 'String containing expression macro {?{host:item.date()}=1}.', 'String containing expression macro {?date()=1}.' ] ]; } /** * @dataProvider simpleProviderData * * @param string $old_event_name * @param string $new_event_name */ public function testSimpleConversion(string $old_event_name, string $new_event_name) { $this->assertSame($new_event_name, $this->converter->convert($old_event_name, '', '')); } }