integration test auth method
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user