1*48555a30SAndreas Gohr<?php 2*48555a30SAndreas Gohr 3*48555a30SAndreas Gohrclass template_tpl_get_action_test extends DokuWikiTest { 4*48555a30SAndreas Gohr 5*48555a30SAndreas Gohr public function setUp() { 6*48555a30SAndreas Gohr parent::setUp(); 7*48555a30SAndreas Gohr global $ID; 8*48555a30SAndreas Gohr $ID = 'start'; // run all tests on the start page 9*48555a30SAndreas Gohr 10*48555a30SAndreas Gohr } 11*48555a30SAndreas Gohr 12*48555a30SAndreas Gohr public function test_edit_edit() { 13*48555a30SAndreas Gohr global $ACT; 14*48555a30SAndreas Gohr global $INFO; 15*48555a30SAndreas Gohr global $REV; 16*48555a30SAndreas Gohr 17*48555a30SAndreas Gohr $ACT = 'show'; 18*48555a30SAndreas Gohr $REV = ''; 19*48555a30SAndreas Gohr $INFO['writable'] = true; 20*48555a30SAndreas Gohr $INFO['exists'] = true; 21*48555a30SAndreas Gohr $INFO['draft'] = ''; 22*48555a30SAndreas Gohr 23*48555a30SAndreas Gohr $expect = array( 24*48555a30SAndreas Gohr 'accesskey' => 'e', 25*48555a30SAndreas Gohr 'type' => 'edit', 26*48555a30SAndreas Gohr 'id' => 'start', 27*48555a30SAndreas Gohr 'method' => 'post', 28*48555a30SAndreas Gohr 'params' => array( 29*48555a30SAndreas Gohr 'do' => 'edit', 30*48555a30SAndreas Gohr 'rev' => '', 31*48555a30SAndreas Gohr ), 32*48555a30SAndreas Gohr 'nofollow' => true, 33*48555a30SAndreas Gohr 'replacement' => '', 34*48555a30SAndreas Gohr ); 35*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('edit')); 36*48555a30SAndreas Gohr } 37*48555a30SAndreas Gohr 38*48555a30SAndreas Gohr public function test_edit_edit_rev() { 39*48555a30SAndreas Gohr global $ACT; 40*48555a30SAndreas Gohr global $INFO; 41*48555a30SAndreas Gohr global $REV; 42*48555a30SAndreas Gohr 43*48555a30SAndreas Gohr $ACT = 'show'; 44*48555a30SAndreas Gohr $REV = '1234'; 45*48555a30SAndreas Gohr $INFO['writable'] = true; 46*48555a30SAndreas Gohr $INFO['exists'] = true; 47*48555a30SAndreas Gohr $INFO['draft'] = ''; 48*48555a30SAndreas Gohr 49*48555a30SAndreas Gohr $expect = array( 50*48555a30SAndreas Gohr 'accesskey' => 'e', 51*48555a30SAndreas Gohr 'type' => 'edit', 52*48555a30SAndreas Gohr 'id' => 'start', 53*48555a30SAndreas Gohr 'method' => 'post', 54*48555a30SAndreas Gohr 'params' => array( 55*48555a30SAndreas Gohr 'do' => 'edit', 56*48555a30SAndreas Gohr 'rev' => '1234', 57*48555a30SAndreas Gohr ), 58*48555a30SAndreas Gohr 'nofollow' => true, 59*48555a30SAndreas Gohr 'replacement' => '', 60*48555a30SAndreas Gohr ); 61*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('edit')); 62*48555a30SAndreas Gohr } 63*48555a30SAndreas Gohr 64*48555a30SAndreas Gohr public function test_edit_create() { 65*48555a30SAndreas Gohr global $ACT; 66*48555a30SAndreas Gohr global $INFO; 67*48555a30SAndreas Gohr global $REV; 68*48555a30SAndreas Gohr 69*48555a30SAndreas Gohr $ACT = 'show'; 70*48555a30SAndreas Gohr $REV = ''; 71*48555a30SAndreas Gohr $INFO['writable'] = true; 72*48555a30SAndreas Gohr $INFO['exists'] = false; 73*48555a30SAndreas Gohr $INFO['draft'] = ''; 74*48555a30SAndreas Gohr 75*48555a30SAndreas Gohr $expect = array( 76*48555a30SAndreas Gohr 'accesskey' => 'e', 77*48555a30SAndreas Gohr 'type' => 'create', 78*48555a30SAndreas Gohr 'id' => 'start', 79*48555a30SAndreas Gohr 'method' => 'post', 80*48555a30SAndreas Gohr 'params' => array( 81*48555a30SAndreas Gohr 'do' => 'edit', 82*48555a30SAndreas Gohr 'rev' => '', 83*48555a30SAndreas Gohr ), 84*48555a30SAndreas Gohr 'nofollow' => true, 85*48555a30SAndreas Gohr 'replacement' => '', 86*48555a30SAndreas Gohr ); 87*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('edit')); 88*48555a30SAndreas Gohr } 89*48555a30SAndreas Gohr 90*48555a30SAndreas Gohr public function test_edit_draft() { 91*48555a30SAndreas Gohr global $ACT; 92*48555a30SAndreas Gohr global $INFO; 93*48555a30SAndreas Gohr global $REV; 94*48555a30SAndreas Gohr 95*48555a30SAndreas Gohr $ACT = 'show'; 96*48555a30SAndreas Gohr $REV = ''; 97*48555a30SAndreas Gohr $INFO['writable'] = true; 98*48555a30SAndreas Gohr $INFO['exists'] = true; 99*48555a30SAndreas Gohr $INFO['draft'] = 'foobar'; 100*48555a30SAndreas Gohr 101*48555a30SAndreas Gohr $expect = array( 102*48555a30SAndreas Gohr 'accesskey' => 'e', 103*48555a30SAndreas Gohr 'type' => 'draft', 104*48555a30SAndreas Gohr 'id' => 'start', 105*48555a30SAndreas Gohr 'method' => 'post', 106*48555a30SAndreas Gohr 'params' => array( 107*48555a30SAndreas Gohr 'do' => 'draft', 108*48555a30SAndreas Gohr ), 109*48555a30SAndreas Gohr 'nofollow' => true, 110*48555a30SAndreas Gohr 'replacement' => '', 111*48555a30SAndreas Gohr ); 112*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('edit')); 113*48555a30SAndreas Gohr } 114*48555a30SAndreas Gohr 115*48555a30SAndreas Gohr public function test_edit_show() { 116*48555a30SAndreas Gohr global $ACT; 117*48555a30SAndreas Gohr global $INFO; 118*48555a30SAndreas Gohr global $REV; 119*48555a30SAndreas Gohr 120*48555a30SAndreas Gohr $ACT = 'edit'; 121*48555a30SAndreas Gohr $REV = ''; 122*48555a30SAndreas Gohr $INFO['writable'] = true; 123*48555a30SAndreas Gohr $INFO['exists'] = true; 124*48555a30SAndreas Gohr $INFO['draft'] = ''; 125*48555a30SAndreas Gohr 126*48555a30SAndreas Gohr $expect = array( 127*48555a30SAndreas Gohr 'accesskey' => 'v', 128*48555a30SAndreas Gohr 'type' => 'show', 129*48555a30SAndreas Gohr 'id' => 'start', 130*48555a30SAndreas Gohr 'method' => 'get', 131*48555a30SAndreas Gohr 'params' => array( 132*48555a30SAndreas Gohr 'do' => '', 133*48555a30SAndreas Gohr ), 134*48555a30SAndreas Gohr 'nofollow' => true, 135*48555a30SAndreas Gohr 'replacement' => '', 136*48555a30SAndreas Gohr ); 137*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('edit')); 138*48555a30SAndreas Gohr } 139*48555a30SAndreas Gohr 140*48555a30SAndreas Gohr public function test_revisions() { 141*48555a30SAndreas Gohr $expect = array( 142*48555a30SAndreas Gohr 'accesskey' => 'o', 143*48555a30SAndreas Gohr 'type' => 'revs', 144*48555a30SAndreas Gohr 'id' => 'start', 145*48555a30SAndreas Gohr 'method' => 'get', 146*48555a30SAndreas Gohr 'params' => array( 147*48555a30SAndreas Gohr 'do' => 'revisions', 148*48555a30SAndreas Gohr ), 149*48555a30SAndreas Gohr 'nofollow' => true, 150*48555a30SAndreas Gohr 'replacement' => '', 151*48555a30SAndreas Gohr ); 152*48555a30SAndreas Gohr 153*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('history')); 154*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('revisions')); 155*48555a30SAndreas Gohr } 156*48555a30SAndreas Gohr 157*48555a30SAndreas Gohr public function test_recent() { 158*48555a30SAndreas Gohr $expect = array( 159*48555a30SAndreas Gohr 'accesskey' => 'r', 160*48555a30SAndreas Gohr 'type' => 'recent', 161*48555a30SAndreas Gohr 'id' => 'start', 162*48555a30SAndreas Gohr 'method' => 'get', 163*48555a30SAndreas Gohr 'params' => array( 164*48555a30SAndreas Gohr 'do' => 'recent', 165*48555a30SAndreas Gohr ), 166*48555a30SAndreas Gohr 'nofollow' => true, 167*48555a30SAndreas Gohr 'replacement' => '', 168*48555a30SAndreas Gohr 169*48555a30SAndreas Gohr ); 170*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('recent')); 171*48555a30SAndreas Gohr } 172*48555a30SAndreas Gohr 173*48555a30SAndreas Gohr public function test_login() { 174*48555a30SAndreas Gohr $expect = array( 175*48555a30SAndreas Gohr 'accesskey' => null, 176*48555a30SAndreas Gohr 'type' => 'login', 177*48555a30SAndreas Gohr 'id' => 'start', 178*48555a30SAndreas Gohr 'method' => 'get', 179*48555a30SAndreas Gohr 'params' => array( 180*48555a30SAndreas Gohr 'do' => 'login', 181*48555a30SAndreas Gohr 'sectok' => '', 182*48555a30SAndreas Gohr ), 183*48555a30SAndreas Gohr 'nofollow' => true, 184*48555a30SAndreas Gohr 'replacement' => '', 185*48555a30SAndreas Gohr ); 186*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('login')); 187*48555a30SAndreas Gohr 188*48555a30SAndreas Gohr $_SERVER['REMOTE_USER'] = 'someone'; // logged in user 189*48555a30SAndreas Gohr 190*48555a30SAndreas Gohr $expect = array( 191*48555a30SAndreas Gohr 'accesskey' => null, 192*48555a30SAndreas Gohr 'type' => 'logout', 193*48555a30SAndreas Gohr 'id' => 'start', 194*48555a30SAndreas Gohr 'method' => 'get', 195*48555a30SAndreas Gohr 'params' => array( 196*48555a30SAndreas Gohr 'do' => 'logout', 197*48555a30SAndreas Gohr 'sectok' => getSecurityToken(), 198*48555a30SAndreas Gohr ), 199*48555a30SAndreas Gohr 'nofollow' => true, 200*48555a30SAndreas Gohr 'replacement' => '', 201*48555a30SAndreas Gohr ); 202*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('login')); 203*48555a30SAndreas Gohr } 204*48555a30SAndreas Gohr 205*48555a30SAndreas Gohr public function test_profile() { 206*48555a30SAndreas Gohr $expect = false; 207*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('profile')); 208*48555a30SAndreas Gohr 209*48555a30SAndreas Gohr $_SERVER['REMOTE_USER'] = 'someone'; // logged in user 210*48555a30SAndreas Gohr 211*48555a30SAndreas Gohr $expect = array( 212*48555a30SAndreas Gohr 'accesskey' => null, 213*48555a30SAndreas Gohr 'type' => 'profile', 214*48555a30SAndreas Gohr 'id' => 'start', 215*48555a30SAndreas Gohr 'method' => 'get', 216*48555a30SAndreas Gohr 'params' => array( 217*48555a30SAndreas Gohr 'do' => 'profile', 218*48555a30SAndreas Gohr ), 219*48555a30SAndreas Gohr 'nofollow' => true, 220*48555a30SAndreas Gohr 'replacement' => '', 221*48555a30SAndreas Gohr ); 222*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('profile')); 223*48555a30SAndreas Gohr } 224*48555a30SAndreas Gohr 225*48555a30SAndreas Gohr public function test_index() { 226*48555a30SAndreas Gohr $expect = array( 227*48555a30SAndreas Gohr 'accesskey' => 'x', 228*48555a30SAndreas Gohr 'type' => 'index', 229*48555a30SAndreas Gohr 'id' => 'start', 230*48555a30SAndreas Gohr 'method' => 'get', 231*48555a30SAndreas Gohr 'params' => array( 232*48555a30SAndreas Gohr 'do' => 'index', 233*48555a30SAndreas Gohr ), 234*48555a30SAndreas Gohr 'nofollow' => false, 235*48555a30SAndreas Gohr 'replacement' => '', 236*48555a30SAndreas Gohr ); 237*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('index')); 238*48555a30SAndreas Gohr 239*48555a30SAndreas Gohr global $ID; 240*48555a30SAndreas Gohr $ID = 'wiki:syntax'; // change to different page 241*48555a30SAndreas Gohr 242*48555a30SAndreas Gohr $expect = array( 243*48555a30SAndreas Gohr 'accesskey' => 'x', 244*48555a30SAndreas Gohr 'type' => 'index', 245*48555a30SAndreas Gohr 'id' => 'wiki:syntax', 246*48555a30SAndreas Gohr 'method' => 'get', 247*48555a30SAndreas Gohr 'params' => array( 248*48555a30SAndreas Gohr 'do' => 'index', 249*48555a30SAndreas Gohr ), 250*48555a30SAndreas Gohr 'nofollow' => true, 251*48555a30SAndreas Gohr 'replacement' => '', 252*48555a30SAndreas Gohr ); 253*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('index')); 254*48555a30SAndreas Gohr } 255*48555a30SAndreas Gohr 256*48555a30SAndreas Gohr public function test_admin() { 257*48555a30SAndreas Gohr $expect = false; 258*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('admin')); 259*48555a30SAndreas Gohr 260*48555a30SAndreas Gohr // logged in super user 261*48555a30SAndreas Gohr global $INFO; 262*48555a30SAndreas Gohr $_SERVER['REMOTE_USER'] = 'testuser'; 263*48555a30SAndreas Gohr $INFO['ismanager'] = true; 264*48555a30SAndreas Gohr 265*48555a30SAndreas Gohr $expect = array( 266*48555a30SAndreas Gohr 'accesskey' => null, 267*48555a30SAndreas Gohr 'type' => 'admin', 268*48555a30SAndreas Gohr 'id' => 'start', 269*48555a30SAndreas Gohr 'method' => 'get', 270*48555a30SAndreas Gohr 'params' => array( 271*48555a30SAndreas Gohr 'do' => 'admin', 272*48555a30SAndreas Gohr ), 273*48555a30SAndreas Gohr 'nofollow' => true, 274*48555a30SAndreas Gohr 'replacement' => '', 275*48555a30SAndreas Gohr ); 276*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('admin')); 277*48555a30SAndreas Gohr } 278*48555a30SAndreas Gohr 279*48555a30SAndreas Gohr public function test_top() { 280*48555a30SAndreas Gohr $expect = array( 281*48555a30SAndreas Gohr 'accesskey' => 't', 282*48555a30SAndreas Gohr 'type' => 'top', 283*48555a30SAndreas Gohr 'id' => '#dokuwiki__top', 284*48555a30SAndreas Gohr 'method' => 'get', 285*48555a30SAndreas Gohr 'params' => array( 286*48555a30SAndreas Gohr 'do' => '', 287*48555a30SAndreas Gohr ), 288*48555a30SAndreas Gohr 'nofollow' => true, 289*48555a30SAndreas Gohr 'replacement' => '', 290*48555a30SAndreas Gohr ); 291*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('top')); 292*48555a30SAndreas Gohr } 293*48555a30SAndreas Gohr 294*48555a30SAndreas Gohr public function test_back() { 295*48555a30SAndreas Gohr $expect = false; 296*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('back')); 297*48555a30SAndreas Gohr 298*48555a30SAndreas Gohr global $ID; 299*48555a30SAndreas Gohr $ID = 'wiki:syntax'; 300*48555a30SAndreas Gohr 301*48555a30SAndreas Gohr $expect = array( 302*48555a30SAndreas Gohr 'accesskey' => 'b', 303*48555a30SAndreas Gohr 'type' => 'back', 304*48555a30SAndreas Gohr 'id' => 'wiki:start', 305*48555a30SAndreas Gohr 'method' => 'get', 306*48555a30SAndreas Gohr 'params' => array( 307*48555a30SAndreas Gohr 'do' => '', 308*48555a30SAndreas Gohr ), 309*48555a30SAndreas Gohr 'nofollow' => true, 310*48555a30SAndreas Gohr 'replacement' => '', 311*48555a30SAndreas Gohr ); 312*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('back')); 313*48555a30SAndreas Gohr } 314*48555a30SAndreas Gohr 315*48555a30SAndreas Gohr public function test_backlink() { 316*48555a30SAndreas Gohr $expect = array( 317*48555a30SAndreas Gohr 'accesskey' => null, 318*48555a30SAndreas Gohr 'type' => 'backlink', 319*48555a30SAndreas Gohr 'id' => 'start', 320*48555a30SAndreas Gohr 'method' => 'get', 321*48555a30SAndreas Gohr 'params' => array( 322*48555a30SAndreas Gohr 'do' => 'backlink', 323*48555a30SAndreas Gohr ), 324*48555a30SAndreas Gohr 'nofollow' => true, 325*48555a30SAndreas Gohr 'replacement' => '', 326*48555a30SAndreas Gohr ); 327*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('backlink')); 328*48555a30SAndreas Gohr } 329*48555a30SAndreas Gohr 330*48555a30SAndreas Gohr public function test_subscribe() { 331*48555a30SAndreas Gohr $expect = false; 332*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('subscribe')); 333*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('subscription')); 334*48555a30SAndreas Gohr 335*48555a30SAndreas Gohr $_SERVER['REMOTE_USER'] = 'someone'; // logged in user 336*48555a30SAndreas Gohr 337*48555a30SAndreas Gohr $expect = false; 338*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('subscribe')); 339*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('subscription')); 340*48555a30SAndreas Gohr 341*48555a30SAndreas Gohr // enable subscriptions 342*48555a30SAndreas Gohr global $conf; 343*48555a30SAndreas Gohr $conf['subscribers'] = true; 344*48555a30SAndreas Gohr 345*48555a30SAndreas Gohr $expect = array( 346*48555a30SAndreas Gohr 'accesskey' => null, 347*48555a30SAndreas Gohr 'type' => 'subscribe', 348*48555a30SAndreas Gohr 'id' => 'start', 349*48555a30SAndreas Gohr 'method' => 'get', 350*48555a30SAndreas Gohr 'params' => array( 351*48555a30SAndreas Gohr 'do' => 'subscribe', 352*48555a30SAndreas Gohr ), 353*48555a30SAndreas Gohr 'nofollow' => true, 354*48555a30SAndreas Gohr 'replacement' => '', 355*48555a30SAndreas Gohr ); 356*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('subscribe')); 357*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('subscription')); 358*48555a30SAndreas Gohr } 359*48555a30SAndreas Gohr 360*48555a30SAndreas Gohr public function test_register() { 361*48555a30SAndreas Gohr $expect = array( 362*48555a30SAndreas Gohr 'accesskey' => null, 363*48555a30SAndreas Gohr 'type' => 'register', 364*48555a30SAndreas Gohr 'id' => 'start', 365*48555a30SAndreas Gohr 'method' => 'get', 366*48555a30SAndreas Gohr 'params' => array( 367*48555a30SAndreas Gohr 'do' => 'register', 368*48555a30SAndreas Gohr ), 369*48555a30SAndreas Gohr 'nofollow' => true, 370*48555a30SAndreas Gohr 'replacement' => '', 371*48555a30SAndreas Gohr ); 372*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('register')); 373*48555a30SAndreas Gohr 374*48555a30SAndreas Gohr $_SERVER['REMOTE_USER'] = 'somebody'; // logged in user 375*48555a30SAndreas Gohr 376*48555a30SAndreas Gohr $expect = false; 377*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('register')); 378*48555a30SAndreas Gohr } 379*48555a30SAndreas Gohr 380*48555a30SAndreas Gohr public function test_resendpwd() { 381*48555a30SAndreas Gohr $expect = array( 382*48555a30SAndreas Gohr 'accesskey' => null, 383*48555a30SAndreas Gohr 'type' => 'resendpwd', 384*48555a30SAndreas Gohr 'id' => 'start', 385*48555a30SAndreas Gohr 'method' => 'get', 386*48555a30SAndreas Gohr 'params' => array( 387*48555a30SAndreas Gohr 'do' => 'resendpwd', 388*48555a30SAndreas Gohr ), 389*48555a30SAndreas Gohr 'nofollow' => true, 390*48555a30SAndreas Gohr 'replacement' => '', 391*48555a30SAndreas Gohr ); 392*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('resendpwd')); 393*48555a30SAndreas Gohr 394*48555a30SAndreas Gohr $_SERVER['REMOTE_USER'] = 'somebody'; // logged in user 395*48555a30SAndreas Gohr 396*48555a30SAndreas Gohr $expect = false; 397*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('resendpwd')); 398*48555a30SAndreas Gohr } 399*48555a30SAndreas Gohr 400*48555a30SAndreas Gohr public function test_revert() { 401*48555a30SAndreas Gohr $expect = false; 402*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('revert')); 403*48555a30SAndreas Gohr 404*48555a30SAndreas Gohr global $REV; 405*48555a30SAndreas Gohr global $INFO; 406*48555a30SAndreas Gohr $REV = '1234'; 407*48555a30SAndreas Gohr $INFO['writable'] = true; 408*48555a30SAndreas Gohr $INFO['ismanager'] = true; 409*48555a30SAndreas Gohr 410*48555a30SAndreas Gohr $expect = array( 411*48555a30SAndreas Gohr 'accesskey' => null, 412*48555a30SAndreas Gohr 'type' => 'revert', 413*48555a30SAndreas Gohr 'id' => 'start', 414*48555a30SAndreas Gohr 'method' => 'get', // FIXME should this be post? 415*48555a30SAndreas Gohr 'params' => array( 416*48555a30SAndreas Gohr 'do' => 'revert', 417*48555a30SAndreas Gohr 'rev' => '1234', 418*48555a30SAndreas Gohr 'sectok' => '' // FIXME is this correct? 419*48555a30SAndreas Gohr ), 420*48555a30SAndreas Gohr 'nofollow' => true, 421*48555a30SAndreas Gohr 'replacement' => '', 422*48555a30SAndreas Gohr ); 423*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('revert')); 424*48555a30SAndreas Gohr } 425*48555a30SAndreas Gohr 426*48555a30SAndreas Gohr public function test_media() { 427*48555a30SAndreas Gohr global $ID; 428*48555a30SAndreas Gohr $ID = 'wiki:syntax'; 429*48555a30SAndreas Gohr 430*48555a30SAndreas Gohr $expect = array( 431*48555a30SAndreas Gohr 'accesskey' => null, 432*48555a30SAndreas Gohr 'type' => 'media', 433*48555a30SAndreas Gohr 'id' => 'wiki:syntax', 434*48555a30SAndreas Gohr 'method' => 'get', 435*48555a30SAndreas Gohr 'params' => array( 436*48555a30SAndreas Gohr 'do' => 'media', 437*48555a30SAndreas Gohr 'ns' => 'wiki' 438*48555a30SAndreas Gohr ), 439*48555a30SAndreas Gohr 'nofollow' => true, 440*48555a30SAndreas Gohr 'replacement' => '', 441*48555a30SAndreas Gohr ); 442*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('media')); 443*48555a30SAndreas Gohr } 444*48555a30SAndreas Gohr 445*48555a30SAndreas Gohr public function test_mediaManager() { 446*48555a30SAndreas Gohr global $IMG; 447*48555a30SAndreas Gohr $IMG = 'wiki:dokuwiki.png'; 448*48555a30SAndreas Gohr 449*48555a30SAndreas Gohr $expect = array( 450*48555a30SAndreas Gohr 'accesskey' => null, 451*48555a30SAndreas Gohr 'type' => 'mediaManager', 452*48555a30SAndreas Gohr 'id' => 'start', 453*48555a30SAndreas Gohr 'method' => 'get', 454*48555a30SAndreas Gohr 'params' => array( 455*48555a30SAndreas Gohr 'do' => 'media', 456*48555a30SAndreas Gohr 'ns' => 'wiki', 457*48555a30SAndreas Gohr 'image' => 'wiki:dokuwiki.png' 458*48555a30SAndreas Gohr ), 459*48555a30SAndreas Gohr 'nofollow' => true, 460*48555a30SAndreas Gohr 'replacement' => '', 461*48555a30SAndreas Gohr ); 462*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('mediaManager')); 463*48555a30SAndreas Gohr } 464*48555a30SAndreas Gohr 465*48555a30SAndreas Gohr public function test_img_backto() { 466*48555a30SAndreas Gohr $expect = array( 467*48555a30SAndreas Gohr 'accesskey' => 'b', 468*48555a30SAndreas Gohr 'type' => 'img_backto', 469*48555a30SAndreas Gohr 'id' => 'start', 470*48555a30SAndreas Gohr 'method' => 'get', 471*48555a30SAndreas Gohr 'params' => array(), 472*48555a30SAndreas Gohr 'nofollow' => true, 473*48555a30SAndreas Gohr 'replacement' => 'start', 474*48555a30SAndreas Gohr ); 475*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('img_backto')); 476*48555a30SAndreas Gohr } 477*48555a30SAndreas Gohr 478*48555a30SAndreas Gohr public function test_unknown() { 479*48555a30SAndreas Gohr $expect = '[unknown %s type]'; 480*48555a30SAndreas Gohr $this->assertEquals($expect, tpl_get_action('unknown')); 481*48555a30SAndreas Gohr } 482*48555a30SAndreas Gohr 483*48555a30SAndreas Gohr} 484