From e3776c06c37cc197709dac60892604dfea894ac2 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Mon, 29 Nov 2010 01:34:36 +0100 Subject: Remove enc=utf-8 in VIM modeline as it is not allowed in VIM 7.3 As of VIM 7.3 it is no longer possible to specify the encoding in the modeline. This gives an error message whenever such a file is opened, thus this commit removes the enc setting from the modeline. --- _test/cases/inc/IXR_Library_IXR_Message.test.php | 2 +- _test/cases/inc/IXR_Library_date.test.php | 2 +- _test/cases/inc/auth_aclcheck.test.php | 2 +- _test/cases/inc/auth_admincheck.test.php | 2 +- _test/cases/inc/auth_nameencode.test.php | 2 +- _test/cases/inc/auth_password.test.php | 2 +- _test/cases/inc/common_clientip.test.php | 2 +- _test/cases/inc/common_obfuscate.test.php | 2 +- _test/cases/inc/common_pagetemplate.test.php | 2 +- _test/cases/inc/indexer_idx_indexlengths.test.php | 2 +- _test/cases/inc/init_fullpath.test.php | 2 +- _test/cases/inc/init_getbaseurl.test.php | 2 +- _test/cases/inc/mail_isvalid.test.php | 2 +- _test/cases/inc/mail_quoted_printable_encode.php | 2 +- _test/cases/inc/mail_send.php | 2 +- _test/cases/inc/pageutils_clean_id.test.php | 2 +- _test/cases/inc/pageutils_getid.test.php | 2 +- _test/cases/inc/pageutils_resolve_id.test.php | 2 +- _test/cases/inc/pageutils_resolve_pageid.test.php | 2 +- _test/cases/inc/safefn.test.php | 2 +- _test/cases/inc/utf8_correctidx.test.php | 2 +- _test/cases/inc/utf8_html.test.php | 2 +- _test/cases/inc/utf8_romanize.test.php | 2 +- _test/cases/inc/utf8_stripspecials.test.php | 2 +- _test/cases/inc/utf8_substr.test.php | 2 +- _test/cases/inc/utf8_unicode.test.php | 2 +- _test/cases/inc/utf8_utf16be.test.php | 2 +- _test/cases/lib/exe/css_css_compress.test.php | 2 +- _test/cases/lib/exe/js_js_compress.test.php | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) (limited to '_test') diff --git a/_test/cases/inc/IXR_Library_IXR_Message.test.php b/_test/cases/inc/IXR_Library_IXR_Message.test.php index 2a8133230..bc9be572d 100644 --- a/_test/cases/inc/IXR_Library_IXR_Message.test.php +++ b/_test/cases/inc/IXR_Library_IXR_Message.test.php @@ -136,4 +136,4 @@ class ixr_library_ixr_message_test extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/IXR_Library_date.test.php b/_test/cases/inc/IXR_Library_date.test.php index a2b6154d8..28fa86486 100644 --- a/_test/cases/inc/IXR_Library_date.test.php +++ b/_test/cases/inc/IXR_Library_date.test.php @@ -31,4 +31,4 @@ class ixr_library_date_test extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/auth_aclcheck.test.php b/_test/cases/inc/auth_aclcheck.test.php index d8a8f285a..ff092c2de 100644 --- a/_test/cases/inc/auth_aclcheck.test.php +++ b/_test/cases/inc/auth_aclcheck.test.php @@ -228,4 +228,4 @@ class auth_acl_test extends UnitTestCase { } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/auth_admincheck.test.php b/_test/cases/inc/auth_admincheck.test.php index f14d6369e..b21c2fe27 100644 --- a/_test/cases/inc/auth_admincheck.test.php +++ b/_test/cases/inc/auth_admincheck.test.php @@ -50,4 +50,4 @@ class auth_admin_test extends UnitTestCase { } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/auth_nameencode.test.php b/_test/cases/inc/auth_nameencode.test.php index 28ab6dc4a..56806a862 100644 --- a/_test/cases/inc/auth_nameencode.test.php +++ b/_test/cases/inc/auth_nameencode.test.php @@ -47,4 +47,4 @@ class auth_nameencode_test extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/auth_password.test.php b/_test/cases/inc/auth_password.test.php index 1ba731c7e..cb1cd5593 100644 --- a/_test/cases/inc/auth_password.test.php +++ b/_test/cases/inc/auth_password.test.php @@ -40,4 +40,4 @@ class auth_password_test extends UnitTestCase { } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/common_clientip.test.php b/_test/cases/inc/common_clientip.test.php index 4df463539..68c108165 100644 --- a/_test/cases/inc/common_clientip.test.php +++ b/_test/cases/inc/common_clientip.test.php @@ -152,4 +152,4 @@ class common_clientIP_test extends UnitTestCase { } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/common_obfuscate.test.php b/_test/cases/inc/common_obfuscate.test.php index 3e1e1a72f..31321bea1 100644 --- a/_test/cases/inc/common_obfuscate.test.php +++ b/_test/cases/inc/common_obfuscate.test.php @@ -25,4 +25,4 @@ class common_obfuscate_test extends UnitTestCase { } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/common_pagetemplate.test.php b/_test/cases/inc/common_pagetemplate.test.php index ecba0f966..2db8b64ae 100644 --- a/_test/cases/inc/common_pagetemplate.test.php +++ b/_test/cases/inc/common_pagetemplate.test.php @@ -16,4 +16,4 @@ class common_pagetemplate_test extends UnitTestCase { error_reporting($old); } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/indexer_idx_indexlengths.test.php b/_test/cases/inc/indexer_idx_indexlengths.test.php index 8565639be..a0f7c9224 100644 --- a/_test/cases/inc/indexer_idx_indexlengths.test.php +++ b/_test/cases/inc/indexer_idx_indexlengths.test.php @@ -57,4 +57,4 @@ class indexer_idx_indexlengths_test extends UnitTestCase { } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/init_fullpath.test.php b/_test/cases/inc/init_fullpath.test.php index 63394b09d..aa63b0ce9 100644 --- a/_test/cases/inc/init_fullpath.test.php +++ b/_test/cases/inc/init_fullpath.test.php @@ -86,4 +86,4 @@ class init_fullpath_test extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/init_getbaseurl.test.php b/_test/cases/inc/init_getbaseurl.test.php index edd370d61..d9c76801f 100644 --- a/_test/cases/inc/init_getbaseurl.test.php +++ b/_test/cases/inc/init_getbaseurl.test.php @@ -277,4 +277,4 @@ class init_getBaseURL_test extends UnitTestCase { } } -//Setup VIM: ex: et ts=2 enc=utf-8 : +//Setup VIM: ex: et ts=2 : diff --git a/_test/cases/inc/mail_isvalid.test.php b/_test/cases/inc/mail_isvalid.test.php index 374204679..4e047499f 100644 --- a/_test/cases/inc/mail_isvalid.test.php +++ b/_test/cases/inc/mail_isvalid.test.php @@ -80,4 +80,4 @@ class mail_isvalid extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/mail_quoted_printable_encode.php b/_test/cases/inc/mail_quoted_printable_encode.php index c9cb040f1..a5a36e35b 100644 --- a/_test/cases/inc/mail_quoted_printable_encode.php +++ b/_test/cases/inc/mail_quoted_printable_encode.php @@ -41,4 +41,4 @@ class mail_quotedprintable_encode extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/mail_send.php b/_test/cases/inc/mail_send.php index 5c2b0e896..e41c501fe 100644 --- a/_test/cases/inc/mail_send.php +++ b/_test/cases/inc/mail_send.php @@ -46,4 +46,4 @@ class mail_send extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/pageutils_clean_id.test.php b/_test/cases/inc/pageutils_clean_id.test.php index 9c03ce334..01fa7dc1c 100644 --- a/_test/cases/inc/pageutils_clean_id.test.php +++ b/_test/cases/inc/pageutils_clean_id.test.php @@ -144,4 +144,4 @@ class init_clean_id_test extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/pageutils_getid.test.php b/_test/cases/inc/pageutils_getid.test.php index e3932a579..7fccc3a60 100644 --- a/_test/cases/inc/pageutils_getid.test.php +++ b/_test/cases/inc/pageutils_getid.test.php @@ -103,4 +103,4 @@ class init_getID_test extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/pageutils_resolve_id.test.php b/_test/cases/inc/pageutils_resolve_id.test.php index 64b4033cd..9aa4ee8b7 100644 --- a/_test/cases/inc/pageutils_resolve_id.test.php +++ b/_test/cases/inc/pageutils_resolve_id.test.php @@ -42,4 +42,4 @@ class init_resolve_id_test extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/pageutils_resolve_pageid.test.php b/_test/cases/inc/pageutils_resolve_pageid.test.php index ab282b57a..d9ea89869 100644 --- a/_test/cases/inc/pageutils_resolve_pageid.test.php +++ b/_test/cases/inc/pageutils_resolve_pageid.test.php @@ -60,4 +60,4 @@ class init_resolve_pageid_test extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/safefn.test.php b/_test/cases/inc/safefn.test.php index b93914bf8..c789875ba 100644 --- a/_test/cases/inc/safefn.test.php +++ b/_test/cases/inc/safefn.test.php @@ -32,4 +32,4 @@ class safeFN_test extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/utf8_correctidx.test.php b/_test/cases/inc/utf8_correctidx.test.php index d95ce9ae0..20f6ba3a3 100644 --- a/_test/cases/inc/utf8_correctidx.test.php +++ b/_test/cases/inc/utf8_correctidx.test.php @@ -75,4 +75,4 @@ class utf8_correctidx_test extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/utf8_html.test.php b/_test/cases/inc/utf8_html.test.php index 57c9df259..3e6d35bc7 100644 --- a/_test/cases/inc/utf8_html.test.php +++ b/_test/cases/inc/utf8_html.test.php @@ -69,4 +69,4 @@ class utf8_html_test extends UnitTestCase { } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/utf8_romanize.test.php b/_test/cases/inc/utf8_romanize.test.php index 9aade570b..950c8842a 100644 --- a/_test/cases/inc/utf8_romanize.test.php +++ b/_test/cases/inc/utf8_romanize.test.php @@ -33,4 +33,4 @@ class utf8_romanize_test extends UnitTestCase { $this->assertEqual("a A a A a o O",utf8_romanize("å Å ä Ä ä ö Ö")); } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/utf8_stripspecials.test.php b/_test/cases/inc/utf8_stripspecials.test.php index a42507a3c..85df75fa1 100644 --- a/_test/cases/inc/utf8_stripspecials.test.php +++ b/_test/cases/inc/utf8_stripspecials.test.php @@ -24,4 +24,4 @@ class utf8_stripspecials extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/utf8_substr.test.php b/_test/cases/inc/utf8_substr.test.php index f3bf1b154..2806d34f1 100644 --- a/_test/cases/inc/utf8_substr.test.php +++ b/_test/cases/inc/utf8_substr.test.php @@ -40,4 +40,4 @@ class utf8_substr_test extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/utf8_unicode.test.php b/_test/cases/inc/utf8_unicode.test.php index 453aad216..424f47d11 100644 --- a/_test/cases/inc/utf8_unicode.test.php +++ b/_test/cases/inc/utf8_unicode.test.php @@ -57,4 +57,4 @@ class utf8_unicode_test extends UnitTestCase { } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/inc/utf8_utf16be.test.php b/_test/cases/inc/utf8_utf16be.test.php index 3a346da51..d8b8746f2 100644 --- a/_test/cases/inc/utf8_utf16be.test.php +++ b/_test/cases/inc/utf8_utf16be.test.php @@ -25,4 +25,4 @@ class utf8_utf16be_test extends UnitTestCase { } } -//Setup VIM: ex: et ts=2 enc=utf-8 : +//Setup VIM: ex: et ts=2 : diff --git a/_test/cases/lib/exe/css_css_compress.test.php b/_test/cases/lib/exe/css_css_compress.test.php index 026caad3c..527071bbe 100644 --- a/_test/cases/lib/exe/css_css_compress.test.php +++ b/_test/cases/lib/exe/css_css_compress.test.php @@ -65,4 +65,4 @@ class css_css_compress_test extends UnitTestCase { } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : diff --git a/_test/cases/lib/exe/js_js_compress.test.php b/_test/cases/lib/exe/js_js_compress.test.php index 9051dfb01..76b51e5ab 100644 --- a/_test/cases/lib/exe/js_js_compress.test.php +++ b/_test/cases/lib/exe/js_js_compress.test.php @@ -120,4 +120,4 @@ class js_js_compress_test extends UnitTestCase { } } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : -- cgit v1.2.3 From d6dc956f8c13064c5e638d5ba817123f66261cfe Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Wed, 8 Dec 2010 23:41:59 +0100 Subject: added auth_isMember() This function abstracts checking a given user and her groups against a given member list (as used in the superuser and manager options). It is also used in auth_isManager() and auth_isAdmin(), unlike the previous function, this one skips the nameencode step as it should be unnessary here (all input is given decoded). The test cases where extended by some non-ID user and group names. People with non-plain auth backends should check that their administrator and manager setups still work as expected --- _test/cases/inc/auth_admincheck.test.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to '_test') diff --git a/_test/cases/inc/auth_admincheck.test.php b/_test/cases/inc/auth_admincheck.test.php index b21c2fe27..01dd38df7 100644 --- a/_test/cases/inc/auth_admincheck.test.php +++ b/_test/cases/inc/auth_admincheck.test.php @@ -15,8 +15,8 @@ class auth_admin_test extends UnitTestCase { function test_ismanager(){ global $conf; - $conf['superuser'] = 'john,@admin'; - $conf['manager'] = 'john,@managers,doe'; + $conf['superuser'] = 'john,@admin,@Mötly Görls, Dörte'; + $conf['manager'] = 'john,@managers,doe, @Mötly Böys, Dänny'; // anonymous user $this->assertEqual(auth_ismanager('jill', null,false), false); @@ -25,9 +25,15 @@ class auth_admin_test extends UnitTestCase { $this->assertEqual(auth_ismanager('john', null,false), true); $this->assertEqual(auth_ismanager('doe', null,false), true); + $this->assertEqual(auth_ismanager('dörte', null,false), true); + $this->assertEqual(auth_ismanager('dänny', null,false), true); + // admin or manager groups $this->assertEqual(auth_ismanager('jill', array('admin'),false), true); $this->assertEqual(auth_ismanager('jill', array('managers'),false), true); + + $this->assertEqual(auth_ismanager('jill', array('mötly görls'),false), true); + $this->assertEqual(auth_ismanager('jill', array('mötly böys'),false), true); } function test_isadmin(){ -- cgit v1.2.3 From 4f56ecbf9229ff893b58cf34012a9646a06f91c0 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Tue, 21 Dec 2010 13:20:10 +0100 Subject: Fix handling of case in auth_isMember; add and fix test cases --- _test/cases/inc/auth_admincheck.test.php | 78 ++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 3 deletions(-) (limited to '_test') diff --git a/_test/cases/inc/auth_admincheck.test.php b/_test/cases/inc/auth_admincheck.test.php index 01dd38df7..a71c8801a 100644 --- a/_test/cases/inc/auth_admincheck.test.php +++ b/_test/cases/inc/auth_admincheck.test.php @@ -3,17 +3,44 @@ require_once DOKU_INC.'inc/init.php'; require_once DOKU_INC.'inc/auth.php'; +class auth_admin_test_AuthInSensitive extends auth_basic { + function isCaseSensitive(){ + return false; + } +} + class auth_admin_test extends UnitTestCase { + private $oldauth; + + function setup() { + global $auth; + $this->oldauth = $auth; + parent::setup(); + } + + function setSensitive() { + global $auth; + $auth = new auth_basic; + } + + function setInSensitive() { + global $auth; + $auth = new auth_admin_test_AuthInSensitive; + } + function teardown() { + global $auth; global $conf; global $AUTH_ACL; unset($conf); unset($AUTH_ACL); - + $auth = $this->oldauth; + parent::teardown(); } - function test_ismanager(){ + function test_ismanager_insensitive(){ + $this->setInSensitive(); global $conf; $conf['superuser'] = 'john,@admin,@Mötly Görls, Dörte'; $conf['manager'] = 'john,@managers,doe, @Mötly Böys, Dänny'; @@ -36,7 +63,8 @@ class auth_admin_test extends UnitTestCase { $this->assertEqual(auth_ismanager('jill', array('mötly böys'),false), true); } - function test_isadmin(){ + function test_isadmin_insensitive(){ + $this->setInSensitive(); global $conf; $conf['superuser'] = 'john,@admin,doe,@roots'; @@ -54,6 +82,50 @@ class auth_admin_test extends UnitTestCase { $this->assertEqual(auth_ismanager('doe', array('admin'),true), true); } + function test_ismanager_sensitive(){ + $this->setSensitive(); + global $conf; + $conf['superuser'] = 'john,@admin,@Mötly Görls, Dörte'; + $conf['manager'] = 'john,@managers,doe, @Mötly Böys, Dänny'; + + // anonymous user + $this->assertEqual(auth_ismanager('jill', null,false), false); + + // admin or manager users + $this->assertEqual(auth_ismanager('john', null,false), true); + $this->assertEqual(auth_ismanager('doe', null,false), true); + + $this->assertEqual(auth_ismanager('dörte', null,false), false); + $this->assertEqual(auth_ismanager('dänny', null,false), false); + + // admin or manager groups + $this->assertEqual(auth_ismanager('jill', array('admin'),false), true); + $this->assertEqual(auth_ismanager('jill', array('managers'),false), true); + + $this->assertEqual(auth_ismanager('jill', array('mötly görls'),false), false); + $this->assertEqual(auth_ismanager('jill', array('mötly böys'),false), false); + } + + function test_isadmin_sensitive(){ + $this->setSensitive(); + global $conf; + $conf['superuser'] = 'john,@admin,doe,@roots'; + + // anonymous user + $this->assertEqual(auth_ismanager('jill', null,true), false); + + // admin user + $this->assertEqual(auth_ismanager('john', null,true), true); + $this->assertEqual(auth_ismanager('Doe', null,true), false); + + // admin groups + $this->assertEqual(auth_ismanager('jill', array('admin'),true), true); + $this->assertEqual(auth_ismanager('jill', array('roots'),true), true); + $this->assertEqual(auth_ismanager('john', array('admin'),true), true); + $this->assertEqual(auth_ismanager('doe', array('admin'),true), true); + $this->assertEqual(auth_ismanager('Doe', array('admin'),true), true); + } + } //Setup VIM: ex: et ts=4 : -- cgit v1.2.3 From be96545ccf297b7b2a7bf10b2d0f35d636e8adf6 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Mon, 3 Jan 2011 15:46:10 +0000 Subject: removed obsolete references to 'JSnocheck' class --- _test/cases/inc/parser/xhtml_links.test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '_test') diff --git a/_test/cases/inc/parser/xhtml_links.test.php b/_test/cases/inc/parser/xhtml_links.test.php index 6a74445b0..0ad96c793 100644 --- a/_test/cases/inc/parser/xhtml_links.test.php +++ b/_test/cases/inc/parser/xhtml_links.test.php @@ -12,7 +12,7 @@ class xhtml_links_test extends UnitTestCase { $p = new Doku_Renderer_xhtml(); $p->emaillink('foo@example.com',''); - $expect = '<script>alert('"alert"');</script>'; + $expect = '<script>alert('"alert"');</script>'; $this->assertEqual($p->doc,$expect); } @@ -36,7 +36,7 @@ class xhtml_links_test extends UnitTestCase { $p = new Doku_Renderer_xhtml(); $p->emaillink('foo@example.com',$image); - $expect = 'Some Image'; + $expect = 'Some Image'; $this->assertEqual($p->doc,$expect); } -- cgit v1.2.3 From 6e0b4b67444b8434ed2c351ea0e36008667251d5 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sun, 9 Jan 2011 14:52:50 +0100 Subject: Fixed css_loadfile and removed unneeded complexity, added testcases --- _test/cases/lib/exe/css_css_loadfile.test.php | 57 +++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 _test/cases/lib/exe/css_css_loadfile.test.php (limited to '_test') diff --git a/_test/cases/lib/exe/css_css_loadfile.test.php b/_test/cases/lib/exe/css_css_loadfile.test.php new file mode 100644 index 000000000..a444d0086 --- /dev/null +++ b/_test/cases/lib/exe/css_css_loadfile.test.php @@ -0,0 +1,57 @@ +file = tempnam('/tmp', 'css'); + parent::setUp(); + } + + private function csstest($input, $output = null, $location = 'http://www.example.com/') { + io_saveFile($this->file, $input); + $this->assertEqual(css_loadfile($this->file, $location), (is_null($output) ? $input : $output)); + } + + public function test_url_relative() { + $this->csstest('#test { background: url("test/test.png"); }', '#test { background: url("http://www.example.com/test/test.png"); }'); + $this->csstest('#test { background: url(\'test/test.png\'); }', '#test { background: url(\'http://www.example.com/test/test.png\'); }'); + } + + public function test_url_absolute() { + $this->csstest('#test { background: url("/test/test.png"); }'); + $this->csstest('#test { background: url(\'/test/test.png\'); }'); + } + + public function test_url_with_protocol() { + $this->csstest('#test { background: url("http://www.test.com/test/test.png"); }'); + $this->csstest('#test { background: url("https://www.test.com/test/test.png"); }'); + $this->csstest('#test { background: url(\'http://www.test.com/test/test.png\'); }'); + $this->csstest('#test { background: url(\'https://www.test.com/test/test.png\'); }'); + } + + public function test_import_relative() { + $this->csstest('@import "test/test.png";', '@import "http://www.example.com/test/test.png";'); + $this->csstest('@import \'test/test.png\';', '@import \'http://www.example.com/test/test.png\';'); + } + + public function test_import_absolute() { + $this->csstest('@import "/test/test.png";'); + $this->csstest('@import \'/test/test.png\';'); + } + + public function test_import_with_protocol() { + $this->csstest('@import "http://www.test.com/test/test.png";'); + $this->csstest('@import "https://www.test.com/test/test.png";'); + $this->csstest('@import \'http://www.test.com/test/test.png\';'); + $this->csstest('@import \'https://www.test.com/test/test.png\';'); + } + + public function tearDown() { + unlink($this->file); + unset($this->file); + parent::tearDown(); + } +} + +//Setup VIM: ex: et ts=4 sw=4 : -- cgit v1.2.3 From ef7df687e4ebf910c7eb86b5a8b2a47b9d121917 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 15 Jan 2011 11:28:59 +0100 Subject: added unit test for kmd5 password hashing --- _test/cases/inc/auth_password.test.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to '_test') diff --git a/_test/cases/inc/auth_password.test.php b/_test/cases/inc/auth_password.test.php index cb1cd5593..77ee9eed3 100644 --- a/_test/cases/inc/auth_password.test.php +++ b/_test/cases/inc/auth_password.test.php @@ -15,6 +15,7 @@ class auth_password_test extends UnitTestCase { 'crypt' => 'ablvoGr1hvZ5k', 'mysql' => '4a1fa3780bd6fd55', 'my411' => '*e5929347e25f82e19e4ebe92f1dc6b6e7c2dbd29', + 'kmd5' => 'a579299436d7969791189acadd86fcb716', ); @@ -22,7 +23,7 @@ class auth_password_test extends UnitTestCase { foreach($this->passes as $method => $hash){ $info = "testing method $method"; $this->signal('failinfo',$info); - $this->assertEqual(auth_cryptPassword('foo'.$method,$method,'abcdefgh'),$hash); + $this->assertEqual(auth_cryptPassword('foo'.$method,$method,'abcdefgh12345678912345678912345678'),$hash); } } -- cgit v1.2.3 From f91977c212fd1c1645f521f6190e1ec32259f7a2 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 15 Jan 2011 12:24:14 +0100 Subject: Added support for Wordpress' password hashing FS#2134 --- _test/cases/inc/auth_password.test.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to '_test') diff --git a/_test/cases/inc/auth_password.test.php b/_test/cases/inc/auth_password.test.php index 77ee9eed3..140c7c23e 100644 --- a/_test/cases/inc/auth_password.test.php +++ b/_test/cases/inc/auth_password.test.php @@ -16,6 +16,8 @@ class auth_password_test extends UnitTestCase { 'mysql' => '4a1fa3780bd6fd55', 'my411' => '*e5929347e25f82e19e4ebe92f1dc6b6e7c2dbd29', 'kmd5' => 'a579299436d7969791189acadd86fcb716', + 'pmd5' => '$P$abcdefgh1RC6Fd32heUzl7EYCG9uGw.', + 'hmd5' => '$H$abcdefgh1ZbJodHxmeXVAhEzTG7IAp.', ); @@ -39,6 +41,11 @@ class auth_password_test extends UnitTestCase { $this->assertTrue(auth_verifyPassword('foo','$1$$n1rTiFE0nRifwV/43bVon/')); } + function test_verifyPassword_fixedpmd5(){ + $this->assertTrue(auth_verifyPassword('test12345','$P$9IQRaTwmfeRo7ud9Fh4E2PdI0S3r.L0')); + $this->assertTrue(auth_verifyPassword('test12345','$H$9IQRaTwmfeRo7ud9Fh4E2PdI0S3r.L0')); + } + } //Setup VIM: ex: et ts=4 : -- cgit v1.2.3 From 204b27c8e0c1bcfa6810ee45bd12fda3f5d83960 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sun, 16 Jan 2011 22:23:54 +0100 Subject: Fix getBaseURL for literal IPv6 addresses in URLs (RFC 2732) + test case --- _test/cases/inc/init_getbaseurl.test.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to '_test') diff --git a/_test/cases/inc/init_getbaseurl.test.php b/_test/cases/inc/init_getbaseurl.test.php index d9c76801f..a22172feb 100644 --- a/_test/cases/inc/init_getbaseurl.test.php +++ b/_test/cases/inc/init_getbaseurl.test.php @@ -275,6 +275,31 @@ class init_getBaseURL_test extends UnitTestCase { $this->assertEqual(getBaseURL(true),$correct_result); } } + + /** + * Absolute URL with IPv6 domain name. + * lighttpd, fastcgi + * + * data provided by Michael Hamann + */ + function test12() { + global $conf; + $conf['basedir'] = ''; + $conf['baseurl'] = ''; + $conf['canonical'] = 0; + + $_SERVER['DOCUMENT_ROOT'] = '/srv/http/'; + $_SERVER['HTTP_HOST'] = '[fd00::6592:39ed:a2ed:2c78]'; + $_SERVER['SCRIPT_FILENAME'] = '/srv/http/~michitux/dokuwiki/doku.php'; + $_SERVER['REQUEST_URI'] = '/~michitux/dokuwiki/doku.php?do=debug'; + $_SERVER['SCRIPT_NAME'] = '/~michitux/dokuwiki/doku.php'; + $_SERVER['PATH_INFO'] = null; + $_SERVER['PATH_TRANSLATED'] = null; + $_SERVER['PHP_SELF'] = '/~michitux/dokuwiki/doku.php'; + $_SERVER['SERVER_PORT'] = '80'; + $_SERVER['SERVER_NAME'] = '[fd00'; + $this->assertEqual(getBaseURL(true), 'http://[fd00::6592:39ed:a2ed:2c78]/~michitux/dokuwiki/'); + } } //Setup VIM: ex: et ts=2 : -- cgit v1.2.3