Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • Markdown_Parser
  • MarkdownExtra_Parser
  • PasswordGetInfoTest
  • PasswordHashTest
  • PasswordNeedsRehashTest
  • PasswordVerifyTest
  • taxonomy_support_WdMarkups
  • Textile
  • Textmark_Parser
  • WdEMailNotifyElement

Functions

  • identify_modifier_markdown
  • Markdown
  • mdwp_add_p
  • mdwp_hide_tags
  • mdwp_MarkdownPost
  • mdwp_show_tags
  • mdwp_strip_p
  • password_get_info
  • password_hash
  • password_needs_rehash
  • password_verify
  • smarty_modifier_markdown
  • strip_comments
  • wd_spamScore
 1 <?php
 2 
 3 class PasswordHashTest extends PHPUnit_Framework_TestCase {
 4     
 5     public function testFuncExists() {
 6         $this->assertTrue(function_exists('password_hash'));
 7     }
 8 
 9     public function testStringLength() {
10         $this->assertEquals(60, strlen(password_hash('foo', PASSWORD_BCRYPT)));
11     }
12 
13     public function testHash() {
14         $hash = password_hash('foo', PASSWORD_BCRYPT);
15         $this->assertEquals($hash, crypt('foo', $hash));
16     }
17 
18     public function testKnownSalt() {
19         $hash = password_hash("rasmuslerdorf", PASSWORD_BCRYPT, array("cost" => 7, "salt" => "usesomesillystringforsalt"));
20         $this->assertEquals('$2y$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi', $hash);
21     }
22 
23     public function testRawSalt() {
24         $hash = password_hash("test", PASSWORD_BCRYPT, array("salt" => "123456789012345678901" . chr(0)));
25         $this->assertEquals('$2y$10$MTIzNDU2Nzg5MDEyMzQ1Nej0NmcAWSLR.oP7XOR9HD/vjUuOj100y', $hash);
26     }
27 
28     /**
29      * @expectedException PHPUnit_Framework_Error
30      */
31     public function testInvalidAlgo() {
32         password_hash('foo', array());
33     }
34 
35     /**
36      * @expectedException PHPUnit_Framework_Error
37      */
38     public function testInvalidAlgo2() {
39         password_hash('foo', 2);
40     }
41 
42     /**
43      * @expectedException PHPUnit_Framework_Error
44      */
45     public function testInvalidPassword() {
46         password_hash(array(), 1);
47     }
48 
49     /**
50      * @expectedException PHPUnit_Framework_Error
51      */
52     public function testInvalidSalt() {
53         password_hash('foo', PASSWORD_BCRYPT, array('salt' => array()));
54     }
55 
56     /**
57      * @expectedException PHPUnit_Framework_Error
58      */
59     public function testInvalidBcryptCostLow() {
60         password_hash('foo', PASSWORD_BCRYPT, array('cost' => 3));
61     }
62         
63     /**
64      * @expectedException PHPUnit_Framework_Error
65      */
66     public function testInvalidBcryptCostHigh() {
67         password_hash('foo', PASSWORD_BCRYPT, array('cost' => 32));
68     }
69 
70     /**
71      * @expectedException PHPUnit_Framework_Error
72      */
73     public function testInvalidBcryptCostInvalid() {
74         password_hash('foo', PASSWORD_BCRYPT, array('cost' => 'foo'));
75     }
76 
77     /**
78      * @expectedException PHPUnit_Framework_Error
79      */
80     public function testInvalidBcryptSaltShort() {
81         password_hash('foo', PASSWORD_BCRYPT, array('salt' => 'abc'));
82     }
83 
84 }
Autodoc API documentation generated by ApiGen 2.8.0