espoTester->getApplication(true, $clearCache); } protected function auth($userName, $password = null, $portalId = null) { $this->userName = $userName; $this->password = $password; $this->portalId = $portalId; if (isset($this->espoTester)) { $this->espoTester->auth($userName, $password, $portalId); } } /** * Get Espo Application * * @return \Espo\Core\Application */ protected function getApplication() { return $this->espoApplication; } /** * Get Espo container * * @return \Espo\Core\Container */ protected function getContainer() { return $this->getApplication()->getContainer(); } protected function sendRequest($method, $action, $data = null) { return $this->espoTester->sendRequest($method, $action, $data); } protected function setUp() { $params = array( 'dataFile' => $this->dataFile, 'pathToFiles' => $this->pathToFiles, 'className' => get_class($this), ); $this->espoTester = new Tester($params); $this->espoTester->initialize(); $this->auth($this->userName, $this->password); $this->beforeStartApplication(); $this->espoApplication = $this->createApplication(); $this->afterStartApplication(); } protected function tearDown() { $this->espoTester->terminate(); $this->espoTester = NULL; $this->espoApplication = NULL; } protected function createUser($userData, array $role = null, $isPortal = false) { return $this->espoTester->createUser($userData, $role, $isPortal); } protected function beforeStartApplication() { } protected function afterStartApplication() { } }