Hackzilla\PasswordGenerator\Tests\Generator\PronounceablePasswordGeneratorTest::testGeneratePassword PHP Method

testGeneratePassword() public method

public testGeneratePassword ( string $vowels, boolean $upperCase, boolean $symbols, boolean $numbers )
$vowels string
$upperCase boolean
$symbols boolean
$numbers boolean
    public function testGeneratePassword($vowels, $upperCase, $symbols, $numbers)
    {
        $this->_object->setParameter(PronounceablePasswordGenerator::PARAMETER_VOWELS, $vowels);
        $this->_object->setOptionValue(ComputerPasswordGenerator::OPTION_LENGTH, 16);
        $this->_object->setOptionValue(ComputerPasswordGenerator::OPTION_LOWER_CASE, true);
        $this->_object->setOptionValue(ComputerPasswordGenerator::OPTION_UPPER_CASE, $upperCase);
        $this->_object->setOptionValue(ComputerPasswordGenerator::OPTION_SYMBOLS, $symbols);
        $this->_object->setOptionValue(ComputerPasswordGenerator::OPTION_NUMBERS, $numbers);
        $passwords = $this->_object->generatePasswords(10);
        foreach ($passwords as $password) {
            $passwordLen = strlen($password);
            $isLastCharVowel = null;
            for ($i = 0; $i < $passwordLen; $i++) {
                $char = $password[$i];
                $isVowel = false !== stripos($vowels, $char);
                if (null !== $isLastCharVowel) {
                    $this->assertNotEquals($isVowel, $isLastCharVowel);
                }
                $isLastCharVowel = $isVowel;
            }
        }
    }
PronounceablePasswordGeneratorTest