'pmadb', 'tracking' => 'tracking', 'trackingwork' => true, ])->toArray(); $template = new Template(); $this->tracking = new Tracking( new SqlQueryForm($template), $template, new Relation($GLOBALS['dbi']), $GLOBALS['dbi'] ); } /** * Tests for filter() method. */ public function testFilter(): void { $data = [ [ 'date' => '20120102', 'username' => 'username1', 'statement' => 'statement1', ], [ 'date' => '20130102', 'username' => 'username2', 'statement' => 'statement2', ], ]; $filter_ts_from = 0; $filter_ts_to = 999999999999; $filter_users = ['username1']; $ret = $this->tracking->filter($data, $filter_ts_from, $filter_ts_to, $filter_users); $this->assertEquals('username1', $ret[0]['username']); $this->assertEquals('statement1', $ret[0]['statement']); } /** * Tests for extractTableNames() method from nested table_list. */ public function testExtractTableNames(): void { $GLOBALS['cfg']['NavigationTreeTableSeparator'] = '_'; $table_list = [ 'hello_' => [ 'is_group' => 1, 'lovely_' => [ 'is_group' => 1, 'hello_lovely_world' => ['Name' => 'hello_lovely_world'], 'hello_lovely_world2' => ['Name' => 'hello_lovely_world2'], ], 'hello_world' => ['Name' => 'hello_world'], ], ]; $untracked_tables = $this->tracking->extractTableNames($table_list, 'db', true); $this->assertContains('hello_world', $untracked_tables); $this->assertContains('hello_lovely_world', $untracked_tables); $this->assertContains('hello_lovely_world2', $untracked_tables); } public function testGetHtmlForMain(): void { $html = $this->tracking->getHtmlForMainPage('PMA_db', 'PMA_table', [], 'ltr'); $this->assertStringContainsString('PMA_db.PMA_table', $html); $this->assertStringContainsString('date_created', $html); $this->assertStringContainsString(__('Delete version'), $html); $this->assertStringContainsString('
', $html); $this->assertStringContainsString('
', $html); $this->assertStringContainsString('
', $html); $this->assertStringContainsString('