1<?php 2 3namespace dokuwiki\plugin\struct\test\action; 4 5use dokuwiki\plugin\struct\meta\AccessTable; 6use dokuwiki\plugin\struct\test\StructTest; 7 8/** 9 * @covers action_plugin_struct_aggregationeditor 10 * 11 * @group plugin_struct 12 * @group plugins 13 * @group integration 14 */ 15class LookupAjaxAction extends StructTest 16{ 17 public function setUp(): void 18 { 19 parent::setUp(); 20 21 $this->loadSchemaJSON('wikilookup', '', 0); 22 23 /** @var \helper_plugin_struct $helper */ 24 $helper = plugin_load('helper', 'struct'); 25 26 $saveDate = [ 27 'FirstFieldText' => 'abc def', 28 'SecondFieldLongText' => "abc\ndef\n", 29 'ThirdFieldWiki' => " * hi\n * ho", 30 ]; 31 $access = AccessTable::getGlobalAccess('wikilookup'); 32 $helper->saveLookupData($access, $saveDate); 33 } 34 35 public function testSaveGlobalDataEvent() 36 { 37 $testLabel = 'testcontent'; 38 global $INPUT; 39 $INPUT->post->set('schema', 'wikilookup'); 40 $INPUT->post->set('entry', ['FirstFieldText' => $testLabel]); 41 $INPUT->post->set('searchconf', json_encode([ 42 'schemas' => [['wikilookup', '']], 43 'cols' => ['*'] 44 ])); 45 $call = 'plugin_struct_aggregationeditor_save'; 46 $evt = new \Doku_Event('AJAX_CALL_UNKNOWN', $call); 47 48 $this->expectOutputRegex('/\s*<tr.*' . $testLabel . '.*<\/td>\s*/'); 49 50 $evt->advise_before(); 51 } 52} 53