/** * testSavePasswordSettings * * @see 0003008: add password policies */ public function testSavePasswordSettings() { $testAuthenticationData = $this->_json->loadAuthenticationData(); $configs = array('changepw' => TRUE, 'pwPolicyActive' => TRUE, 'pwPolicyMinLength' => 1, 'pwPolicyMinWordChars' => 1); foreach ($configs as $config => $value) { $testAuthenticationData['password'][$config] = $value; } $result = $this->_json->saveAuthentication($testAuthenticationData); $this->assertTrue($result['success'], 'saveAuthentication unsuccessful'); $testAuthenticationData = $this->_json->loadAuthenticationData(); $this->assertTrue(isset($testAuthenticationData['password']), 'pw settings not found: ' . print_r($testAuthenticationData, TRUE)); foreach ($configs as $config => $expected) { $this->assertEquals($expected, $testAuthenticationData['password'][$config], 'pw setting ' . $config . ' not found: ' . print_r($testAuthenticationData['password'], TRUE)); } }
/** * testSaveAuthenticationSql */ public function testSaveAuthenticationSql() { $testAuthenticationData = $this->_json->loadAuthenticationData(); $testAuthenticationData['authentication']['backend'] = Tinebase_Auth::SQL; $testAuthenticationData['authentication'][Tinebase_Auth::SQL]['adminLoginName'] = 'phpunit-admin'; $testAuthenticationData['authentication'][Tinebase_Auth::SQL]['adminPassword'] = '******'; $testAuthenticationData['authentication'][Tinebase_Auth::SQL]['adminPasswordConfirmation'] = 'phpunit-password'; $this->_uninstallAllApps(); $result = $this->_json->saveAuthentication($testAuthenticationData); $savedAuthenticationData = $this->_json->loadAuthenticationData(); $adminUser = Tinebase_User::getInstance()->getFullUserByLoginName('phpunit-admin'); $this->assertTrue($adminUser instanceof Tinebase_Model_User); //test if Tinebase stack was installed $apps = $this->_json->searchApplications(); $baseApplicationStack = array('Tinebase', 'Admin', 'Addressbook'); foreach ($apps['results'] as $app) { if ($app['install_status'] === 'uptodate' && false !== ($index = array_search($app['name'], $baseApplicationStack))) { unset($baseApplicationStack[$index]); } } $this->assertTrue(empty($baseApplicationStack), 'Assure that base application stack was installed after saving authentication'); $this->_uninstallAllApps(); //Ensure that all aps get re-installed with default username/password because some tests rely on these values }