integration test auth method

This commit is contained in:
yuri
2019-05-13 12:31:15 +03:00
parent 34f1c196f1
commit 1eec3d88cf
2 changed files with 9 additions and 5 deletions
+4 -3
View File
@@ -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();
+5 -2
View File
@@ -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();
}