From 5a41afe6e3b958291893a0a10105cd41971fb141 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sun, 1 Dec 2013 17:57:03 +0000 Subject: FS#1833 (b) Prevent table entry syntax swallowing multiple preceeding blank lines (a) this shouldn't be necessary, blank lines are handled by paragraph processing (b) avoids issues with greedy table syntax competing with plugins --- _test/tests/inc/parser/parser_table.test.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to '_test') diff --git a/_test/tests/inc/parser/parser_table.test.php b/_test/tests/inc/parser/parser_table.test.php index 542a307b8..bc19ebff9 100644 --- a/_test/tests/inc/parser/parser_table.test.php +++ b/_test/tests/inc/parser/parser_table.test.php @@ -626,5 +626,24 @@ def'); ); $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); } + + function testTable_FS1833() { + $syntax = " \n| Row 0 Col 1 |\n"; + $this->P->addMode('table',new Doku_Parser_Mode_Table()); + $this->P->parse($syntax); + $calls = array ( + array('document_start',array()), + array('table_open',array(1, 1, 2)), + array('tablerow_open',array()), + array('tablecell_open',array(1,'left',1)), + array('cdata',array(' Row 0 Col 1 ')), + array('tablecell_close',array()), + array('tablerow_close',array()), + array('table_close',array(strlen($syntax))), + array('document_end',array()), + ); + $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls); + } + } -- cgit v1.2.3 From 6be717dbb579e1cc7e2fbb82d7ddade3e5892c47 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sun, 1 Dec 2013 21:25:29 +0100 Subject: Fix sending empty and duplicated headers, FS#2887 This fixes sending empty and duplicated To/Cc/Bcc, Subject and From headers in the additional headers. The To-header in the additional headers prevented mail sending on some systems. --- _test/tests/inc/mailer.test.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to '_test') diff --git a/_test/tests/inc/mailer.test.php b/_test/tests/inc/mailer.test.php index bac0c39ba..4541d9906 100644 --- a/_test/tests/inc/mailer.test.php +++ b/_test/tests/inc/mailer.test.php @@ -154,7 +154,19 @@ class mailer_test extends DokuWikiTest { $headers['Cc'] = ''; $header = $mail->prepareHeaders(); $this->assertEquals(0, preg_match('/(^|\n)Bcc: (\n|$)/', $header), 'Bcc found in headers.'); - $this->assertEquals(0, preg_match('/(^|\n)Cc: (\n|$)/', $header), 'Bcc found in headers.'); + $this->assertEquals(0, preg_match('/(^|\n)Cc: (\n|$)/', $header), 'Cc found in headers.'); + } + + function test_nullTOorCCorBCC() { + $mail = new TestMailer(); + $headers = &$mail->propRef('headers'); + $headers['Bcc'] = NULL; + $headers['Cc'] = NULL; + $headers['To'] = NULL; + $header = $mail->prepareHeaders(); + $this->assertEquals(0, preg_match('/(^|\n)Bcc: (\n|$)/', $header), 'Bcc found in headers.'); + $this->assertEquals(0, preg_match('/(^|\n)Cc: (\n|$)/', $header), 'Cc found in headers.'); + $this->assertEquals(0, preg_match('/(^|\n)To: (\n|$)/', $header), 'To found in headers.'); } /** -- cgit v1.2.3 From ccfec5606dae81e6524f6cfcdaca09d4cde7f111 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sat, 7 Dec 2013 23:10:05 +0000 Subject: crlf 2 lf whitespace fixes --- _test/tests/inc/common_basicinfo.test.php | 10 ++--- _test/tests/inc/common_mediainfo.test.php | 10 ++--- _test/tests/inc/common_pageinfo.test.php | 66 +++++++++++++++---------------- _test/tests/test/basic.test.php | 12 +++--- 4 files changed, 49 insertions(+), 49 deletions(-) (limited to '_test') diff --git a/_test/tests/inc/common_basicinfo.test.php b/_test/tests/inc/common_basicinfo.test.php index 0369474c9..8359c0877 100644 --- a/_test/tests/inc/common_basicinfo.test.php +++ b/_test/tests/inc/common_basicinfo.test.php @@ -18,12 +18,12 @@ class common_infofunctions_test extends DokuWikiTest { function _get_info() { global $USERINFO; - $info = array ( - 'isadmin' => true, + $info = array ( + 'isadmin' => true, 'ismanager' => true, - 'userinfo' => $USERINFO, - 'perm' => 255, - 'namespace' => false, + 'userinfo' => $USERINFO, + 'perm' => 255, + 'namespace' => false, 'ismobile' => false, 'client' => 'testuser', ); diff --git a/_test/tests/inc/common_mediainfo.test.php b/_test/tests/inc/common_mediainfo.test.php index 0e67fbcd9..cc5b17ec7 100644 --- a/_test/tests/inc/common_mediainfo.test.php +++ b/_test/tests/inc/common_mediainfo.test.php @@ -18,12 +18,12 @@ class common_basicinfo_test extends DokuWikiTest { function _get_info() { global $USERINFO; - $info = array ( - 'isadmin' => true, + $info = array ( + 'isadmin' => true, 'ismanager' => true, - 'userinfo' => $USERINFO, - 'perm' => 255, - 'namespace' => false, + 'userinfo' => $USERINFO, + 'perm' => 255, + 'namespace' => false, 'ismobile' => false, 'client' => 'testuser', ); diff --git a/_test/tests/inc/common_pageinfo.test.php b/_test/tests/inc/common_pageinfo.test.php index c54fbce26..0a1ea0a8f 100644 --- a/_test/tests/inc/common_pageinfo.test.php +++ b/_test/tests/inc/common_pageinfo.test.php @@ -31,18 +31,18 @@ class common_pageinfo_test extends DokuWikiTest { 'ismobile' => false, 'client' => 'testuser', ); - $info['rev'] = null; - $info['subscribed'] = false; - $info['locked'] = false; - $info['exists'] = false; - $info['writable'] = true; - $info['editable'] = true; - $info['lastmod'] = false; - $info['meta'] = array(); - $info['ip'] = null; - $info['user'] = null; - $info['sum'] = null; - $info['editor'] = null; + $info['rev'] = null; + $info['subscribed'] = false; + $info['locked'] = false; + $info['exists'] = false; + $info['writable'] = true; + $info['editable'] = true; + $info['lastmod'] = false; + $info['meta'] = array(); + $info['ip'] = null; + $info['user'] = null; + $info['sum'] = null; + $info['editor'] = null; return $info; } @@ -72,15 +72,15 @@ class common_pageinfo_test extends DokuWikiTest { $rev = filemtime($filename); $info = $this->_get_expected_pageinfo(); - $info['id'] = 'wiki:syntax'; + $info['id'] = 'wiki:syntax'; $info['namespace'] = 'wiki'; $info['filepath'] = $filename; - $info['exists'] = true; - $info['lastmod'] = $rev; - $info['meta'] = p_get_metadata($ID); + $info['exists'] = true; + $info['lastmod'] = $rev; + $info['meta'] = p_get_metadata($ID); $this->assertEquals($info, pageinfo()); - } + } /** * check info keys and values for anonymous user @@ -88,8 +88,8 @@ class common_pageinfo_test extends DokuWikiTest { function test_anonymoususer(){ global $ID,$conf,$REV; - unset($_SERVER['REMOTE_USER']); - global $USERINFO; $USERINFO = array(); + unset($_SERVER['REMOTE_USER']); + global $USERINFO; $USERINFO = array(); $ID = 'wiki:syntax'; $filename = $conf['datadir'].'/wiki/syntax.txt'; @@ -104,15 +104,15 @@ class common_pageinfo_test extends DokuWikiTest { $info['meta'] = p_get_metadata($ID); $info['rev'] = ''; - $info = array_merge($info, array( - 'isadmin' => false, - 'ismanager' => false, - 'perm' => 8, - 'client' => '1.2.3.4', + $info = array_merge($info, array( + 'isadmin' => false, + 'ismanager' => false, + 'perm' => 8, + 'client' => '1.2.3.4', )); unset($info['userinfo']); $this->assertEquals($info, pageinfo()); - } + } /** * check info keys and values with $REV @@ -135,7 +135,7 @@ class common_pageinfo_test extends DokuWikiTest { $this->assertEquals($info, pageinfo()); $this->assertEquals($rev-100, $REV); - } + } /** * check info keys and values with $RANGE @@ -146,7 +146,7 @@ class common_pageinfo_test extends DokuWikiTest { $ID = 'wiki:syntax'; $filename = $conf['datadir'].'/wiki/syntax.txt'; $rev = filemtime($filename); - $range = '1000-2000'; + $range = '1000-2000'; $info = $this->_get_expected_pageinfo(); $info['id'] = 'wiki:syntax'; @@ -160,18 +160,18 @@ class common_pageinfo_test extends DokuWikiTest { // expected result $RANGE unchanged $RANGE = $range; - $this->assertEquals($info, pageinfo()); + $this->assertEquals($info, pageinfo()); $this->assertFalse(isset($REV)); - $this->assertEquals($range,$RANGE); + $this->assertEquals($range,$RANGE); // check $RANGE with $REV = current // expected result: $RANGE unchanged, $REV cleared $REV = $rev; - $info['rev'] = ''; + $info['rev'] = ''; - $this->assertEquals($info, pageinfo()); + $this->assertEquals($info, pageinfo()); $this->assertEquals('',$REV); - $this->assertEquals($range,$RANGE); + $this->assertEquals($range,$RANGE); // check with a real $REV // expected result: $REV and $RANGE are cleared @@ -218,7 +218,7 @@ class common_pageinfo_test extends DokuWikiTest { p_set_metadata($ID,array('last_change' => false)); $this->assertEquals($info, pageinfo()); - $this->assertEquals($info['meta']['last_change'], p_get_metadata($ID,'last_change')); + $this->assertEquals($info['meta']['last_change'], p_get_metadata($ID,'last_change')); // fake an external edit, pageinfo should clear the last change from meta data // and not return any editor data diff --git a/_test/tests/test/basic.test.php b/_test/tests/test/basic.test.php index 05778ccf9..86acef935 100644 --- a/_test/tests/test/basic.test.php +++ b/_test/tests/test/basic.test.php @@ -123,11 +123,11 @@ class InttestsBasicTest extends DokuWikiTest { $request = new TestRequest(); // doku - $response = $request->get(); - $this->assertEquals('doku.php',$request->getScript()); + $response = $request->get(); + $this->assertEquals('doku.php',$request->getScript()); - $response = $request->get(array(),'/doku.php?id=wiki:dokuwiki&test=foo'); - $this->assertEquals('doku.php',$request->getScript()); + $response = $request->get(array(),'/doku.php?id=wiki:dokuwiki&test=foo'); + $this->assertEquals('doku.php',$request->getScript()); // fetch $response = $request->get(array(),'/lib/exe/fetch.php?media=wiki:dokuwiki-128.png'); @@ -149,8 +149,8 @@ class InttestsBasicTest extends DokuWikiTest { $request = new TestRequest(); $response = $request->get(array(),'/lib/exe/fetch.php?media=wiki:dokuwiki-128.png'); - $headers = $response->getHeaders(); - $this->assertTrue(!empty($headers)); + $headers = $response->getHeaders(); + $this->assertTrue(!empty($headers)); } function testGetHeader(){ -- cgit v1.2.3