From 4eb5e17453694b80e84a83a6960d02ac63cfa320 Mon Sep 17 00:00:00 2001 From: lisps Date: Fri, 22 Nov 2013 13:27:38 +0100 Subject: add test getlastrevisionat --- .../tests/inc/changelog_getlastrevisionat.test.php | 127 +++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 _test/tests/inc/changelog_getlastrevisionat.test.php (limited to '_test') diff --git a/_test/tests/inc/changelog_getlastrevisionat.test.php b/_test/tests/inc/changelog_getlastrevisionat.test.php new file mode 100644 index 000000000..b4d0466b3 --- /dev/null +++ b/_test/tests/inc/changelog_getlastrevisionat.test.php @@ -0,0 +1,127 @@ +getLastRevisionAt($rev); + $this->assertEquals($revsexpected, $revs); + } + + /** + * start at exact current revision of mailinglist page + * + */ + function test_startatexactcurrentrev() { + $rev = 1385051947; + $revsexpected = ''; + + //set a known timestamp + touch(wikiFN($this->pageid), $rev); + + $pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192); + $revs = $pagelog->getLastRevisionAt($rev); + $this->assertEquals($revsexpected, $revs); + + } + + /** + * test a future revision + * + */ + function test_futurerev() { + $rev = 1385051947; + $revsexpected = ''; + + //set a known timestamp + touch(wikiFN($this->pageid), $rev); + + $rev +=1; + + $pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192); + $revs = $pagelog->getLastRevisionAt($rev); + $this->assertEquals($revsexpected, $revs); + + } + + /** + * start at exact last revision of mailinglist page + * + */ + function test_exactlastrev() { + $rev = 1360110636; + $revsexpected = 1360110636; + + $pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192); + $revs = $pagelog->getLastRevisionAt($rev); + $this->assertEquals($revsexpected, $revs); + } + + + /** + * Request not existing revision + * + */ + function test_olderrev() { + $rev = 1; + $revexpected = false; + + $pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192); + $revfound = $pagelog->getLastRevisionAt($rev); + $this->assertEquals($revexpected, $revfound); + } + + /** + * Start at non existing revision somewhere between existing revisions + */ + function test_notexistingrev() { + $rev = 1362525890; + $revexpected = 1362525359; + + $pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192); + $revfound = $pagelog->getLastRevisionAt($rev); + $this->assertEquals($revexpected, $revfound); + } + + /** + * request nonexisting page + * + */ + function test_notexistingpage() { + $rev = 1385051947; + $currentexpected = false; + + $pagelog = new PageChangeLog('nonexistingpage', $chunk_size = 8192); + $current = $pagelog->getLastRevisionAt($rev); + $this->assertEquals($currentexpected, $current); + } +} \ No newline at end of file -- cgit v1.2.3 From 07a7d227f78d5956f62a4164def7c68ca03019ee Mon Sep 17 00:00:00 2001 From: lisps Date: Fri, 22 Nov 2013 14:56:42 +0100 Subject: add test for empty rev in ml() and wl() --- _test/tests/inc/common_ml.test.php | 11 +++++++++++ _test/tests/inc/common_wl.test.php | 11 +++++++++++ 2 files changed, 22 insertions(+) (limited to '_test') diff --git a/_test/tests/inc/common_ml.test.php b/_test/tests/inc/common_ml.test.php index 415c0a88d..027dcaef2 100644 --- a/_test/tests/inc/common_ml.test.php +++ b/_test/tests/inc/common_ml.test.php @@ -146,4 +146,15 @@ class common_ml_test extends DokuWikiTest { $this->assertEquals($expect, ml($id, $args)); } + + function test_ml_empty_rev() { + global $conf; + $conf['useslash'] = 0; + $conf['userewrite'] = 0; + + $args = array('a' => 'b', 'c' => 'd', 'rev' => ''); + + $expect = DOKU_BASE . $this->script . '?a=b&c=d&media=some:img.jpg'; + $this->assertEquals($expect, ml('some:img.jpg', $args)); + } } diff --git a/_test/tests/inc/common_wl.test.php b/_test/tests/inc/common_wl.test.php index 2e34dcae3..4bfde3f39 100644 --- a/_test/tests/inc/common_wl.test.php +++ b/_test/tests/inc/common_wl.test.php @@ -142,6 +142,17 @@ class common_wl_test extends DokuWikiTest { $expect = DOKU_BASE . DOKU_SCRIPT . '/some/one?a=b&c=d'; $this->assertEquals($expect, wl('some:one', 'a=b,c=d', false, '&')); } + + function test_wl_empty_rev() { + global $conf; + $conf['useslash'] = 0; + $conf['userewrite'] = 0; + + $args = array('a' => 'b', 'c' => 'd', 'rev' => ''); + + $expect = DOKU_BASE . DOKU_SCRIPT . '?id=some:&a=b&c=d'; + $this->assertEquals($expect, wl('some:', $args)); + } -- cgit v1.2.3 From 81e7bffefad6e652e45320e87d966712e5711efd Mon Sep 17 00:00:00 2001 From: lisps Date: Mon, 17 Feb 2014 23:48:05 +0100 Subject: rename classname --- _test/tests/inc/changelog_getlastrevisionat.test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '_test') diff --git a/_test/tests/inc/changelog_getlastrevisionat.test.php b/_test/tests/inc/changelog_getlastrevisionat.test.php index b4d0466b3..84b185ce8 100644 --- a/_test/tests/inc/changelog_getlastrevisionat.test.php +++ b/_test/tests/inc/changelog_getlastrevisionat.test.php @@ -7,7 +7,7 @@ * - data/pages/mailinglist.txt * - data/meta/mailinglist.changes */ -class changelog_getrelativerevision_test extends DokuWikiTest { +class changelog_getlastrevisionat_test extends DokuWikiTest { private $pageid = 'mailinglist'; -- cgit v1.2.3 From c42f789c87b115a747a7436d81e7aee886d0ac88 Mon Sep 17 00:00:00 2001 From: Enrico Tagliavini Date: Thu, 30 Jan 2014 15:42:09 +0000 Subject: Adding unit test for is_ssl() this should test the correctness of the return value of is_ssl() function based on various combinations of PHP environment variables --- _test/tests/inc/init_checkssl.test.php | 81 ++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 _test/tests/inc/init_checkssl.test.php (limited to '_test') diff --git a/_test/tests/inc/init_checkssl.test.php b/_test/tests/inc/init_checkssl.test.php new file mode 100644 index 000000000..c57d3c37e --- /dev/null +++ b/_test/tests/inc/init_checkssl.test.php @@ -0,0 +1,81 @@ +assertEquals(is_ssl(), true); + } + + /** + * Running behind a plain HTTP proxy, HTTP between server and proxy + * HTTPS not set + * HTTP_X_FORWARDED_PROTO set to http + */ + function test2() { + $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'http'; + + $this->assertEquals(is_ssl(), false); + } + + /** + * Running behind an SSL proxy, HTTP between server and proxy + * HTTPS set to off, + * HTTP_X_FORWARDED_PROTO set to https + */ + function test3() { + $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https'; + $_SERVER['HTTPS'] = 'off'; + + $this->assertEquals(is_ssl(), true); + } + + /** + * Not running behind a proxy, HTTPS server + * HTTPS set to on, + * HTTP_X_FORWARDED_PROTO not set + */ + function test4() { + $_SERVER['HTTPS'] = 'on'; + + $this->assertEquals(is_ssl(), true); + } + + /** + * Not running behind a proxy, plain HTTP server + * HTTPS not set + * HTTP_X_FORWARDED_PROTO not set + */ + function test5() { + $this->assertEquals(is_ssl(), false); + } + + /** + * Not running behind a proxy, plain HTTP server + * HTTPS set to off + * HTTP_X_FORWARDED_PROTO not set + */ + function test6() { + $_SERVER['HTTPS'] = 'off'; + $this->assertEquals(is_ssl(), false); + } + + /** + * Running behind an SSL proxy, SSL between proxy and HTTP server + * HTTPS set to on, + * HTTP_X_FORWARDED_PROTO set to https + */ + function test7() { + $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https'; + $_SERVER['HTTPS'] = 'on'; + + $this->assertEquals(is_ssl(), true); + } +} -- cgit v1.2.3 From 37abef5f8744159697aa2dc18cc468477f2ca965 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 23 Sep 2014 20:08:09 +0200 Subject: added filter method to INPUT class the filter() function can be chained between the accessor and the value function to get a filtered value. When no filter allable is given in the filter() function, stripctl() is used to strip all control chars (ASCII<32) Examples: $INPUT->post->filter()->str('foobar'); $INPUT->get->filter('myfilter')->int('baz'); --- _test/tests/inc/input.test.php | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to '_test') diff --git a/_test/tests/inc/input.test.php b/_test/tests/inc/input.test.php index cec0b80f6..4a8fb8d71 100644 --- a/_test/tests/inc/input.test.php +++ b/_test/tests/inc/input.test.php @@ -14,8 +14,58 @@ class input_test extends DokuWikiTest { 'empty' => '', 'emptya' => array(), 'do' => array('save' => 'Speichern'), + ); + /** + * custom filter function + * + * @param $string + * @return mixed + */ + public function myfilter($string) { + $string = str_replace('foo', 'bar', $string); + $string = str_replace('baz', '', $string); + return $string; + } + + public function test_filter() { + $_GET = array( + 'foo' => 'foo', + 'zstring'=> "foo\0bar", + 'znull' => "\0", + 'zint' => '42'."\0".'42', + 'zintbaz'=> "baz42", + ); + $_POST = $_GET; + $_REQUEST = $_GET; + $INPUT = new Input(); + + $filter = array($this,'myfilter'); + + $this->assertNotSame('foobar', $INPUT->str('zstring')); + $this->assertSame('foobar', $INPUT->filter()->str('zstring')); + $this->assertSame('bar', $INPUT->filter($filter)->str('foo')); + $this->assertSame('bar', $INPUT->filter()->str('znull', 'bar', true)); + $this->assertNotSame('foobar', $INPUT->str('zstring')); // make sure original input is unmodified + + $this->assertNotSame('foobar', $INPUT->get->str('zstring')); + $this->assertSame('foobar', $INPUT->get->filter()->str('zstring')); + $this->assertSame('bar', $INPUT->get->filter($filter)->str('foo')); + $this->assertSame('bar', $INPUT->get->filter()->str('znull', 'bar', true)); + $this->assertNotSame('foobar', $INPUT->get->str('zstring')); // make sure original input is unmodified + + $this->assertNotSame(4242, $INPUT->int('zint')); + $this->assertSame(4242, $INPUT->filter()->int('zint')); + $this->assertSame(42, $INPUT->filter($filter)->int('zintbaz')); + $this->assertSame(42, $INPUT->filter()->str('znull', 42, true)); + + $this->assertSame(true, $INPUT->bool('znull')); + $this->assertSame(false, $INPUT->filter()->bool('znull')); + + $this->assertSame('foobar', $INPUT->filter()->valid('zstring', array('foobar', 'bang'))); + } + public function test_str() { $_REQUEST = $this->data; $_POST = $this->data; -- cgit v1.2.3 From 70daee86e69783928d3da887a3a3e26b8ab74734 Mon Sep 17 00:00:00 2001 From: LarsDW223 Date: Tue, 14 Oct 2014 16:12:08 +0200 Subject: Corrected compression for ++ and -- operator. Partially fixes #897. --- _test/tests/lib/exe/js_js_compress.test.php | 60 +++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to '_test') diff --git a/_test/tests/lib/exe/js_js_compress.test.php b/_test/tests/lib/exe/js_js_compress.test.php index b1ae2a84f..78e089d89 100644 --- a/_test/tests/lib/exe/js_js_compress.test.php +++ b/_test/tests/lib/exe/js_js_compress.test.php @@ -145,6 +145,66 @@ EOF; $this->assertEquals($out, js_compress($text)); } + function test_plusplus1(){ + $text = 'a = 5 + ++b;'; + $this->assertEquals('a=5+ ++b;',js_compress($text)); + } + + function test_plusplus2(){ + $text = 'a = 5+ ++b;'; + $this->assertEquals('a=5+ ++b;',js_compress($text)); + } + + function test_plusplus3(){ + $text = 'a = 5++ + b;'; + $this->assertEquals('a=5++ +b;',js_compress($text)); + } + + function test_plusplus4(){ + $text = 'a = 5++ +b;'; + $this->assertEquals('a=5++ +b;',js_compress($text)); + } + + function test_minusminus1(){ + $text = 'a = 5 - --b;'; + $this->assertEquals('a=5- --b;',js_compress($text)); + } + + function test_minusminus2(){ + $text = 'a = 5- --b;'; + $this->assertEquals('a=5- --b;',js_compress($text)); + } + + function test_minusminus3(){ + $text = 'a = 5-- - b;'; + $this->assertEquals('a=5-- -b;',js_compress($text)); + } + + function test_minusminus4(){ + $text = 'a = 5-- -b;'; + $this->assertEquals('a=5-- -b;',js_compress($text)); + } + + function test_minusplus1(){ + $text = 'a = 5-- +b;'; + $this->assertEquals('a=5--+b;',js_compress($text)); + } + + function test_minusplus2(){ + $text = 'a = 5-- + b;'; + $this->assertEquals('a=5--+b;',js_compress($text)); + } + + function test_plusminus1(){ + $text = 'a = 5++ - b;'; + $this->assertEquals('a=5++-b;',js_compress($text)); + } + + function test_plusminus2(){ + $text = 'a = 5++ -b;'; + $this->assertEquals('a=5++-b;',js_compress($text)); + } + /** * Test the files provided with the original JsStrip */ -- cgit v1.2.3 From 6275d9067f8a0a7216fece2d49ba2064967bc194 Mon Sep 17 00:00:00 2001 From: LarsDW223 Date: Wed, 15 Oct 2014 10:57:00 +0200 Subject: Ooops...forgot to commit test cases for #897. --- _test/tests/lib/exe/js_js_compress.test.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to '_test') diff --git a/_test/tests/lib/exe/js_js_compress.test.php b/_test/tests/lib/exe/js_js_compress.test.php index 78e089d89..648ede07e 100644 --- a/_test/tests/lib/exe/js_js_compress.test.php +++ b/_test/tests/lib/exe/js_js_compress.test.php @@ -58,6 +58,18 @@ class js_js_compress_test extends DokuWikiTest { $this->assertEquals(js_compress($text), 'text.replace(/"/,"//")'); } + function test_regex_after_and_with_slashes_outside_string(){ + $text = 'if ( peng == bla && /pattern\//.test(url)) request = new Something();'; + $this->assertEquals(js_compress($text), + 'if(peng==bla&&/pattern\//.test(url))request=new Something();'); + } + + function test_regex_after_or_with_slashes_outside_string(){ + $text = 'if ( peng == bla || /pattern\//.test(url)) request = new Something();'; + $this->assertEquals(js_compress($text), + 'if(peng==bla||/pattern\//.test(url))request=new Something();'); + } + function test_dquot1(){ $text = 'var foo="Now what \\" \'do we//get /*here*/ ?";'; $this->assertEquals(js_compress($text), $text); @@ -205,6 +217,12 @@ EOF; $this->assertEquals('a=5++-b;',js_compress($text)); } + function test_unusual_signs(){ + $text='var π = Math.PI, τ = 2 * π, halfπ = π / 2, ε = 1e-6, ε2 = ε * ε, radians = π / 180, degrees = 180 / π;'; + $this->assertEquals(js_compress($text), + 'var π=Math.PI,τ=2*π,halfπ=π/2,ε=1e-6,ε2=ε*ε,radians=π/180,degrees=180/π;'); + } + /** * Test the files provided with the original JsStrip */ -- cgit v1.2.3 From 912be8f66fc77a0999250f2f494ddaeed4b3fa08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= Date: Thu, 27 Nov 2014 18:12:02 +0100 Subject: Add tests: known and unknown external video files --- _test/tests/inc/parser/parser_media.test.php | 78 ++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 _test/tests/inc/parser/parser_media.test.php (limited to '_test') diff --git a/_test/tests/inc/parser/parser_media.test.php b/_test/tests/inc/parser/parser_media.test.php new file mode 100644 index 000000000..0b62473f8 --- /dev/null +++ b/_test/tests/inc/parser/parser_media.test.php @@ -0,0 +1,78 @@ + +*/ +class TestOfDoku_Parser_Media extends TestOfDoku_Parser { + + function testVideoOGVExternal() { + $file = 'http://some.where.far/away.ogv'; + $parser_response = p_get_instructions('{{' . $file . '}}'); + + $calls = array ( + array('document_start',array()), + array('p_open',array()), + array('externalmedia',array($file,null,null,null,null,'cache','details')), + array('cdata',array(null)), + array('p_close',array()), + array('document_end',array()), + ); + $this->assertEquals(array_map('stripbyteindex',$parser_response),$calls); + + $Renderer = new Doku_Renderer_xhtml(); + $url = $Renderer->externalmedia($file,null,null,null,null,'cache','details',true); + //print_r("url: " . $url); + $video = ''."\n"; + $this->assertEquals(substr($url,304),$rest); + } + + /** + * unknown extension of external media file + */ + function testVideoVIDExternal() { + $file = 'http://some.where.far/away.vid'; + $parser_response = p_get_instructions('{{' . $file . '}}'); + + $calls = array( + array('document_start', array()), + array('p_open', array()), + array('externalmedia', array($file, null, null, null, null, 'cache', 'details')), + array('cdata', array(null)), + array('p_close', array()), + array('document_end', array()), + ); + $this->assertEquals(array_map('stripbyteindex', $parser_response), $calls); + + $Renderer = new Doku_Renderer_xhtml(); + $url = $Renderer->externalmedia($file, null, null, null, null, 'cache', 'details', true); + // work around random token + $a_first_part = ''; + $this->assertEquals(substr($url,0,34),$a_first_part); + $this->assertEquals(substr($url,40,121),$a_second_part); + $rest = 'away.vid'; + $this->assertEquals(substr($url,161),$rest); + } +} + +/** + * .oga: + * http://upload.wikimedia.org/wikipedia/commons/6/6b/Meow_of_a_pleading_cat.oga + * + * .wav: + * http://upload.wikimedia.org/wikipedia/commons/8/81/Meow_of_a_Siamese_cat_-_freemaster2.wav + * + * + */ -- cgit v1.2.3 From d47f74a0328452bed21867aa4e20557b7d4564e4 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Mon, 1 Dec 2014 17:05:26 +0000 Subject: update parser tests for change in listitem_open instruction --- _test/tests/inc/parser/parser_footnote.test.php | 2 +- _test/tests/inc/parser/parser_lists.test.php | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to '_test') diff --git a/_test/tests/inc/parser/parser_footnote.test.php b/_test/tests/inc/parser/parser_footnote.test.php index b47a575de..2457fb031 100644 --- a/_test/tests/inc/parser/parser_footnote.test.php +++ b/_test/tests/inc/parser/parser_footnote.test.php @@ -303,7 +303,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser { array('nest', array ( array ( array('footnote_open',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('listcontent_close',array()), diff --git a/_test/tests/inc/parser/parser_lists.test.php b/_test/tests/inc/parser/parser_lists.test.php index e4ef1f83e..6acaff637 100644 --- a/_test/tests/inc/parser/parser_lists.test.php +++ b/_test/tests/inc/parser/parser_lists.test.php @@ -13,7 +13,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { $calls = array ( array('document_start',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('listcontent_close',array()), @@ -46,7 +46,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { $calls = array ( array('document_start',array()), array('listo_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('listcontent_close',array()), @@ -80,7 +80,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { $calls = array ( array('document_start',array()), array('listo_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('listcontent_close',array()), @@ -109,7 +109,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { $calls = array ( array('document_start',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('listcontent_close',array()), @@ -138,7 +138,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser { $calls = array ( array('document_start',array()), array('listo_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('listcontent_close',array()), @@ -188,7 +188,7 @@ Bar'); array('cdata',array("Foo")), array('p_close',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('listcontent_close',array()), @@ -227,7 +227,7 @@ Bar'); $calls = array ( array('document_start',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('strong_open',array()), array('cdata',array("A")), @@ -262,7 +262,7 @@ Bar'); $calls = array ( array('document_start',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('unformatted',array("A")), array('listcontent_close',array()), @@ -291,7 +291,7 @@ Bar'); $calls = array ( array('document_start',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('cdata',array("A")), array('linebreak',array()), @@ -355,7 +355,7 @@ Bar'); $calls = array ( array('document_start',array()), array('listu_open',array()), - array('listitem_open',array(1)), + array('listitem_open',array(1,Doku_Handler_List::NODE)), array('listcontent_open',array()), array('nest', array( array( array('footnote_open',array()), -- cgit v1.2.3 From 90394abd2d0fc66a994a3f81c76e265d0707b351 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Wed, 17 Dec 2014 13:14:02 +0100 Subject: fix global environment during test requests --- _test/core/TestRequest.php | 2 -- 1 file changed, 2 deletions(-) (limited to '_test') diff --git a/_test/core/TestRequest.php b/_test/core/TestRequest.php index 060e37d28..dad2060e5 100644 --- a/_test/core/TestRequest.php +++ b/_test/core/TestRequest.php @@ -45,8 +45,6 @@ class TestRequest { */ public function execute($uri='/doku.php') { global $INPUT; - global $ID; - global $INFO; // save old environment $server = $_SERVER; -- cgit v1.2.3 From db42b6f8860359481248e9bc847b111497511d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= Date: Thu, 18 Dec 2014 10:50:08 +0100 Subject: Add test for internal video files --- _test/data/media/wiki/kind_zu_katze.ogv | Bin 0 -> 45883 bytes _test/data/media/wiki/kind_zu_katze.png | Bin 0 -> 970 bytes _test/data/media/wiki/kind_zu_katze.webm | Bin 0 -> 101529 bytes _test/tests/inc/parser/parser_media.test.php | 35 +++++++++++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 _test/data/media/wiki/kind_zu_katze.ogv create mode 100644 _test/data/media/wiki/kind_zu_katze.png create mode 100644 _test/data/media/wiki/kind_zu_katze.webm (limited to '_test') diff --git a/_test/data/media/wiki/kind_zu_katze.ogv b/_test/data/media/wiki/kind_zu_katze.ogv new file mode 100644 index 000000000..1ad3732dc Binary files /dev/null and b/_test/data/media/wiki/kind_zu_katze.ogv differ diff --git a/_test/data/media/wiki/kind_zu_katze.png b/_test/data/media/wiki/kind_zu_katze.png new file mode 100644 index 000000000..a5c151e3f Binary files /dev/null and b/_test/data/media/wiki/kind_zu_katze.png differ diff --git a/_test/data/media/wiki/kind_zu_katze.webm b/_test/data/media/wiki/kind_zu_katze.webm new file mode 100644 index 000000000..2973ff833 Binary files /dev/null and b/_test/data/media/wiki/kind_zu_katze.webm differ diff --git a/_test/tests/inc/parser/parser_media.test.php b/_test/tests/inc/parser/parser_media.test.php index 0b62473f8..195b95991 100644 --- a/_test/tests/inc/parser/parser_media.test.php +++ b/_test/tests/inc/parser/parser_media.test.php @@ -65,6 +65,41 @@ class TestOfDoku_Parser_Media extends TestOfDoku_Parser { $rest = 'away.vid'; $this->assertEquals(substr($url,161),$rest); } + + + function testVideoOGVInternal() { + $file = 'wiki:kind_zu_katze.ogv'; + $parser_response = p_get_instructions('{{' . $file . '}}'); + + $calls = array ( + array('document_start',array()), + array('p_open',array()), + array('internalmedia',array($file,null,null,null,null,'cache','details')), + array('cdata',array(null)), + array('p_close',array()), + array('document_end',array()), + ); + $this->assertEquals(array_map('stripbyteindex',$parser_response),$calls); + + $Renderer = new Doku_Renderer_xhtml(); + $url = $Renderer->externalmedia($file,null,null,null,null,'cache','details',true); + + $video = ''."\n"; + $this->assertEquals(substr($url,644),$rest); + } } /** -- cgit v1.2.3 From 50e07413f6c62d6593a89dcf070dffd413170aad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= Date: Thu, 18 Dec 2014 11:02:40 +0100 Subject: Fix file size --- _test/tests/inc/parser/parser_media.test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '_test') diff --git a/_test/tests/inc/parser/parser_media.test.php b/_test/tests/inc/parser/parser_media.test.php index 195b95991..e124b85e2 100644 --- a/_test/tests/inc/parser/parser_media.test.php +++ b/_test/tests/inc/parser/parser_media.test.php @@ -92,7 +92,7 @@ class TestOfDoku_Parser_Media extends TestOfDoku_Parser { $source_ogv = ''; $this->assertEquals(substr($url,212,83),$source_ogv); - $a_webm = 'kind_zu_katze.webm'; + $a_webm = 'kind_zu_katze.webm'; $a_ogv = 'kind_zu_katze.ogv'; $this->assertEquals(substr($url,296,176),$a_webm); $this->assertEquals(substr($url,472,172),$a_ogv); -- cgit v1.2.3 From 7268f44f1b278bafced8e85930ba3dd0c92b8900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= Date: Thu, 18 Dec 2014 11:39:15 +0100 Subject: Remove stray comment block --- _test/tests/inc/parser/parser_media.test.php | 10 ---------- 1 file changed, 10 deletions(-) (limited to '_test') diff --git a/_test/tests/inc/parser/parser_media.test.php b/_test/tests/inc/parser/parser_media.test.php index e124b85e2..d9a0626f5 100644 --- a/_test/tests/inc/parser/parser_media.test.php +++ b/_test/tests/inc/parser/parser_media.test.php @@ -101,13 +101,3 @@ class TestOfDoku_Parser_Media extends TestOfDoku_Parser { $this->assertEquals(substr($url,644),$rest); } } - -/** - * .oga: - * http://upload.wikimedia.org/wikipedia/commons/6/6b/Meow_of_a_pleading_cat.oga - * - * .wav: - * http://upload.wikimedia.org/wikipedia/commons/8/81/Meow_of_a_Siamese_cat_-_freemaster2.wav - * - * - */ -- cgit v1.2.3