diff --git a/tests/integration/Core/BaseTestCase.php b/tests/integration/Core/BaseTestCase.php index 821e616d91..953ddb3ac9 100644 --- a/tests/integration/Core/BaseTestCase.php +++ b/tests/integration/Core/BaseTestCase.php @@ -72,14 +72,15 @@ abstract class BaseTestCase extends \PHPUnit\Framework\TestCase return $this->espoTester->getApplication(true, $clearCache); } - protected function auth($userName, $password = null, $portalId = null) + protected function auth($userName, $password = null, $portalId = null, $authenticationMethod = null) { $this->userName = $userName; $this->password = $password; $this->portalId = $portalId; + $this->authenticationMethod = $authenticationMethod; if (isset($this->espoTester)) { - $this->espoTester->auth($userName, $password, $portalId); + $this->espoTester->auth($userName, $password, $portalId, $authenticationMethod); } } @@ -126,7 +127,7 @@ abstract class BaseTestCase extends \PHPUnit\Framework\TestCase $this->espoTester = new Tester($params); $this->espoTester->initialize(); - $this->auth($this->userName, $this->password); + $this->auth($this->userName, $this->password, null, $this->authenticationMethod); $this->beforeStartApplication(); $this->espoApplication = $this->createApplication(); diff --git a/tests/integration/Core/Tester.php b/tests/integration/Core/Tester.php index 4d330af08e..d3d56923b6 100644 --- a/tests/integration/Core/Tester.php +++ b/tests/integration/Core/Tester.php @@ -63,6 +63,8 @@ class Tester protected $portalId = null; + protected $authenticationMethod = null; + protected $defaultUserPassword = '1'; public function __construct(array $params) @@ -107,11 +109,12 @@ class Tester return $returns; } - public function auth($userName, $password = null, $portalId = null) + public function auth($userName, $password = null, $portalId = null, $authenticationMethod = null) { $this->userName = $userName; $this->password = $password; $this->portalId = $portalId; + $this->authenticationMethod = $authenticationMethod; } public function getApplication($reload = false, $clearCache = true) @@ -127,7 +130,7 @@ class Tester if (isset($this->userName)) { $this->password = isset($this->password) ? $this->password : $this->defaultUserPassword; - $auth->login($this->userName, $this->password); + $auth->login($this->userName, $this->password, $this->authenticationMethod); } else { $auth->useNoAuth(); }