Пример #1
0
 public function testPolicyComparisons()
 {
     $this->assertEquals(Policy::NO, UsersModule::getStrongerPolicy(UsersModule::POLICY_ENFORCE_STRONG_PASSWORDS, array(Policy::NO, Policy::NO)));
     $this->assertEquals(Policy::YES, UsersModule::getStrongerPolicy(UsersModule::POLICY_ENFORCE_STRONG_PASSWORDS, array(Policy::YES, Policy::NO)));
     $this->assertEquals(Policy::YES, UsersModule::getStrongerPolicy(UsersModule::POLICY_ENFORCE_STRONG_PASSWORDS, array(Policy::NO, Policy::YES)));
     $this->assertEquals(Policy::YES, UsersModule::getStrongerPolicy(UsersModule::POLICY_ENFORCE_STRONG_PASSWORDS, array(Policy::YES, Policy::YES)));
     $this->assertEquals(10, UsersModule::getStrongerPolicy(UsersModule::POLICY_MINIMUM_PASSWORD_LENGTH, array(10, 10)));
     $this->assertEquals(20, UsersModule::getStrongerPolicy(UsersModule::POLICY_MINIMUM_PASSWORD_LENGTH, array(10, 20)));
     $this->assertEquals(20, UsersModule::getStrongerPolicy(UsersModule::POLICY_MINIMUM_PASSWORD_LENGTH, array(20, 10)));
     $this->assertEquals(10, UsersModule::getStrongerPolicy(UsersModule::POLICY_MINIMUM_USERNAME_LENGTH, array(10, 10)));
     $this->assertEquals(20, UsersModule::getStrongerPolicy(UsersModule::POLICY_MINIMUM_USERNAME_LENGTH, array(10, 20)));
     $this->assertEquals(20, UsersModule::getStrongerPolicy(UsersModule::POLICY_MINIMUM_USERNAME_LENGTH, array(20, 10)));
     $this->assertEquals(10, UsersModule::getStrongerPolicy(UsersModule::POLICY_PASSWORD_EXPIRY_DAYS, array(10, 10)));
     $this->assertEquals(10, UsersModule::getStrongerPolicy(UsersModule::POLICY_PASSWORD_EXPIRY_DAYS, array(10, 20)));
     $this->assertEquals(10, UsersModule::getStrongerPolicy(UsersModule::POLICY_PASSWORD_EXPIRY_DAYS, array(20, 10)));
 }