From e0dd04a6493f1b7f7133f75c08f9ea55ee8bd50a Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 14 Oct 2011 16:39:36 +0200 Subject: Added bcrypt support for password hashes This method require PHP 5.3+ it will fail otherwise! --- _test/cases/inc/auth_password.test.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to '_test') diff --git a/_test/cases/inc/auth_password.test.php b/_test/cases/inc/auth_password.test.php index 928552a14..6fe564e73 100644 --- a/_test/cases/inc/auth_password.test.php +++ b/_test/cases/inc/auth_password.test.php @@ -48,6 +48,11 @@ class auth_password_test extends UnitTestCase { } } + function test_bcrypt_self(){ + $hash = auth_cryptPassword('foobcrypt','bcrypt'); + $this->assertTrue(auth_verifyPassword('foobcrypt',$hash)); + } + function test_verifyPassword_nohash(){ $this->assertTrue(auth_verifyPassword('foo','$1$$n1rTiFE0nRifwV/43bVon/')); } -- cgit v1.2.3 From c8ca60df97ff2b24091c7c0d0db72c680200ea1b Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 27 Nov 2011 11:08:44 +0100 Subject: added test case for lsmd5 passhashing --- _test/cases/inc/auth_password.test.php | 1 + 1 file changed, 1 insertion(+) (limited to '_test') diff --git a/_test/cases/inc/auth_password.test.php b/_test/cases/inc/auth_password.test.php index 928552a14..6c643a7ed 100644 --- a/_test/cases/inc/auth_password.test.php +++ b/_test/cases/inc/auth_password.test.php @@ -12,6 +12,7 @@ class auth_password_test extends UnitTestCase { 'md5' => '8fa22d62408e5351553acdd91c6b7003', 'sha1' => 'b456d3b0efd105d613744ffd549514ecafcfc7e1', 'ssha' => '{SSHA}QMHG+uC7bHNYKkmoLbNsNI38/dJhYmNk', + 'lsmd5' => '{SMD5}HGbkPrkWgy9KgcRGWlrsUWFiY2RlZmdo', 'crypt' => 'ablvoGr1hvZ5k', 'mysql' => '4a1fa3780bd6fd55', 'my411' => '*e5929347e25f82e19e4ebe92f1dc6b6e7c2dbd29', -- cgit v1.2.3 From 0b9869484e3052d68e5939bf626fbd3a840d3062 Mon Sep 17 00:00:00 2001 From: lupo49 Date: Sat, 10 Mar 2012 20:16:28 +0100 Subject: Unit Test: Adding test to check windows share link with hyphen character --- _test/cases/inc/parser/parser_links.test.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to '_test') diff --git a/_test/cases/inc/parser/parser_links.test.php b/_test/cases/inc/parser/parser_links.test.php index 53871e110..d0fb19570 100644 --- a/_test/cases/inc/parser/parser_links.test.php +++ b/_test/cases/inc/parser/parser_links.test.php @@ -400,6 +400,21 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser { ); $this->assertEqual(array_map('stripByteIndex',$this->H->calls),$calls); } + + function testWindowsShareLinkHyphen() { + $this->P->addMode('windowssharelink',new Doku_Parser_Mode_WindowsShareLink()); + $this->P->parse('Foo \\\server\share-hyphen Bar'); + $calls = array ( + array('document_start',array()), + array('p_open',array()), + array('cdata',array("\n".'Foo ')), + array('windowssharelink',array('\\\server\share-hyphen',NULL)), + array('cdata',array(' Bar')), + array('p_close',array()), + array('document_end',array()), + ); + $this->assertEqual(array_map('stripByteIndex',$this->H->calls),$calls); + } function testWindowsShareLinkInternal() { $this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink()); -- cgit v1.2.3 From 9e760ee516dd6e50390490f6d5585b854b895808 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 13 Mar 2012 17:32:53 +0100 Subject: added (failing) test for cleanText() The cleanText function is supposed to convert DOS to Unix lineendings but it seems that it doesn't always do that correctly as this thread suggests: http://forum.dokuwiki.org/thread/8141 I added a unit test that currently fails but haven't found the real cause yet. Further testing (and a fix) is needed. --- _test/cases/inc/common_cleanText.test.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 _test/cases/inc/common_cleanText.test.php (limited to '_test') diff --git a/_test/cases/inc/common_cleanText.test.php b/_test/cases/inc/common_cleanText.test.php new file mode 100644 index 000000000..571e41fa5 --- /dev/null +++ b/_test/cases/inc/common_cleanText.test.php @@ -0,0 +1,31 @@ +assertEqual($unix,cleanText($unix)); + } + + function test_win(){ + $unix = 'one + two + + three'; + $win = 'one + two + + three'; + $this->assertNotEqual($unix,$win); + $this->assertEqual($unix,cleanText($win)); + } +} + +//Setup VIM: ex: et ts=4 : -- cgit v1.2.3 From 6212730ca98f1a8c054d742fa68f988e77be4caf Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 13 Mar 2012 19:08:15 +0100 Subject: the previous test case had an error There were whitespaces on the empty DOS line. This fixes the test but does not explain the broken behaviour in the wiki itself. --- _test/cases/inc/common_cleanText.test.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to '_test') diff --git a/_test/cases/inc/common_cleanText.test.php b/_test/cases/inc/common_cleanText.test.php index 571e41fa5..936ed1d76 100644 --- a/_test/cases/inc/common_cleanText.test.php +++ b/_test/cases/inc/common_cleanText.test.php @@ -19,10 +19,13 @@ class common_clientIP_test extends UnitTestCase { two three'; - $win = 'one + $win = 'one two - + three'; + + $this->assertEqual(bin2hex($unix),'6f6e650a2020202020202020202020202020202074776f0a0a202020202020202020202020202020207468726565'); + $this->assertEqual(bin2hex($win),'6f6e650d0a2020202020202020202020202020202074776f0d0a0d0a202020202020202020202020202020207468726565'); $this->assertNotEqual($unix,$win); $this->assertEqual($unix,cleanText($win)); } -- cgit v1.2.3