espoTester->getApplication(true, $clearCache); } protected function auth($userName, $password = null) { $this->userName = $userName; $this->password = $password; if (isset($this->espoTester)) { $this->espoTester->auth($userName, $password); } } /** * 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 beforeStartApplication() { } protected function afterStartApplication() { } /** * Create a user with roles * * @param string|array $userData - If $userData is a string, then it's a userName with default password * @param array $roles * * @return \Espo\Entities\User */ /*protected function createUser($userData, array $roles) { if (!is_array($userData)) { $userData = array( 'userName' => $userData ); } }*/ }