/** * Test with wrong email */ public function testAuthorizeFail() { $auth = new ExampleAuth($this->_config['user_email'] . 'e', $this->_config['user_password'], $this->_config['client_id'], $this->_config['client_secret'], $this->_config['redirect_uri']); $failed = false; try { $auth->authorize(); } catch (AuthException $e) { $failed = true; } $this->assertTrue($failed); }
/** * */ public function __construct() { parent::__construct(); global $test_config; $this->_config = $test_config; $auth = new ExampleAuth($this->_config['user_email'], $this->_config['user_password'], $this->_config['client_id'], $this->_config['client_secret'], $this->_config['redirect_uri']); $access_token = $auth->getAccessToken(); if (!$access_token) { $access_token = $auth->authorize(); } if (!$access_token) { throw new Exception("Can't get access token"); } $this->_auth = $auth; }