Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
Merge branch '2021.11' into 2022.11
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlabci committed May 12, 2022
2 parents 49ecc16 + 85ee242 commit 55c21a5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
31 changes: 27 additions & 4 deletions tests/tine20/Tinebase/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class Tinebase_ControllerTest extends TestCase
* @access protected
*/
protected function setUp(): void
{
Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
{
parent::setUp();
$this->_instance = Tinebase_Controller::getInstance();
}

Expand All @@ -47,9 +47,9 @@ protected function setUp(): void
* @access protected
*/
protected function tearDown(): void
{
{
Tinebase_Config::getInstance()->maintenanceMode = 0;
Tinebase_TransactionManager::getInstance()->rollBack();
parent::tearDown();
}

/**
Expand Down Expand Up @@ -101,6 +101,29 @@ public function testMaintenanceModeLoginFailAll()
$this->testMaintenanceModeLoginFail(Tinebase_Config::MAINTENANCE_MODE_ALL);
}

public function testLoginCreateMailaccount()
{
$this->_skipWithoutEmailSystemAccountConfig();

$filter = Tinebase_Model_Filter_FilterGroup::getFilterForModel(Felamimail_Model_Account::class, [
['field' => 'user_id', 'operator' => 'equals', 'value' => $this->_personas['sclever']->getId()]
]);
$emailAccounts = Admin_Controller_EmailAccount::getInstance()->search($filter);
Admin_Controller_EmailAccount::getInstance()->delete($emailAccounts->getArrayOfIds());

$this->_instance->login(
'sclever',
Tinebase_Helper::array_value('password', TestServer::getInstance()->getTestCredentials()),
new Tinebase_Http_Request()
);
Tinebase_Core::setUser($this->_originalTestUser);
$filter = Tinebase_Model_Filter_FilterGroup::getFilterForModel(Felamimail_Model_Account::class, [
['field' => 'user_id', 'operator' => 'equals', 'value' => $this->_personas['sclever']->getId()]
]);
$emailAccounts = Admin_Controller_EmailAccount::getInstance()->search($filter);
self::assertEquals(1, count($emailAccounts));
}

/**
* testCleanupCache
*/
Expand Down
2 changes: 1 addition & 1 deletion tine20/Felamimail/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ protected function _handleEvent(Tinebase_Event_Abstract $_eventObject)
public function handleAccountLogin(Tinebase_Model_FullUser $_account, $pwd)
{
if (Tinebase_Config::getInstance()->{Tinebase_Config::IMAP}->{Tinebase_Config::IMAP_USE_SYSTEM_ACCOUNT}
&& ! empty($_account->email)
&& ! empty($_account->accountEmailAddress)
) {
// this is sort of a weird flag to make addSystemAccount do its actual work
$_account->imapUser = new Tinebase_Model_EmailUser(null, true);
Expand Down

0 comments on commit 55c21a5

Please sign in to comment.