Version::VERSION, 'exporttemplateswork' => true, 'trackingwork' => false, 'db' => 'db', 'export_templates' => 'table', ]; $cfg['Server']['user'] = 'user'; $response = new ResponseRenderer(); $template = new Template(); $request = $this->createStub(ServerRequest::class); $request->method('getParsedBodyParam')->willReturnMap([ ['exportType', '', 'type'], ['templateName', '', 'name'], ['templateData', '', 'data'], ['template_id', null, null], ]); (new CreateController( $response, $template, new TemplateModel($this->dbi), new Relation($this->dbi, $template) ))($request); $templates = [ ExportTemplate::fromArray([ 'id' => 1, 'username' => 'user1', 'exportType' => 'type1', 'name' => 'name1', 'data' => 'data1', ]), ExportTemplate::fromArray([ 'id' => 2, 'username' => 'user2', 'exportType' => 'type2', 'name' => 'name2', 'data' => 'data2', ]), ]; $options = $template->render('export/template_options', [ 'templates' => $templates, 'selected_template' => null, ]); $this->assertTrue($response->hasSuccessState()); $this->assertEquals(['data' => $options], $response->getJSONResult()); } }