1<?php 2 3class common_wl_test extends DokuWikiTest { 4 5 private $script = 'lib/exe/fetch.php'; 6 7 function test_ml_empty() { 8 global $conf; 9 $conf['useslash'] = 0; 10 $conf['userewrite'] = 0; 11 $conf['start'] = 'start'; 12 13 $this->assertEquals(DOKU_BASE . $this->script . '?media=' , ml()); 14 } 15 16 function test_ml_args_array() { 17 global $conf; 18 $conf['useslash'] = 0; 19 $conf['userewrite'] = 0; 20 21 $args = array('a' => 'b', 'c' => 'd', 'q' => '&ä'); 22 23 $expect = DOKU_BASE . $this->script . '?a=b&c=d&q=%26%C3%A4&media=some:'; 24 $this->assertEquals($expect, ml('some:', $args)); 25 } 26 27 function test_ml_args_string() { 28 global $conf; 29 $conf['useslash'] = 0; 30 $conf['userewrite'] = 0; 31 32 $args = 'a=b&c=d'; 33 34 $expect = DOKU_BASE . $this->script . '?a=b&c=d&media=some:'; 35 $this->assertEquals($expect, ml('some:', $args)); 36 } 37 38 function test_ml_args_comma_string() { 39 global $conf; 40 $conf['useslash'] = 0; 41 $conf['userewrite'] = 0; 42 43 $args = 'a=b,c=d'; 44 45 $expect = DOKU_BASE . $this->script . '?a=b&c=d&media=some:'; 46 $this->assertEquals($expect, ml('some:', $args)); 47 } 48 49 50 function test_ml_imgresize_array() { 51 global $conf; 52 $conf['useslash'] = 0; 53 $conf['userewrite'] = 0; 54 55 $id = 'some:'; 56 $w = 80; 57 $args = array('w' => $w); 58 $tok = media_get_token($id,$w,0); 59 60 $expect = DOKU_BASE . $this->script . '?w='.$w.'&tok='.$tok.'&media='.$id; 61 $this->assertEquals($expect, ml($id, $args)); 62 } 63 64 function test_ml_imgresize_string() { 65 global $conf; 66 $conf['useslash'] = 0; 67 $conf['userewrite'] = 0; 68 69 $id = 'some:'; 70 $w = 80; 71 $args = 'w='.$w; 72 $tok = media_get_token($id,$w,0); 73 74 $expect = DOKU_BASE . $this->script . '?w='.$w.'&tok='.$tok.'&media='.$id; 75 $this->assertEquals($expect, ml($id, $args)); 76 } 77}