/** * (non-PHPdoc) * * @todo implement if (preg_match('@[\x00-\x1f\x7f]@', $s) === 1) matching on token * @see \mithra62\Validate\RuleInterface::validate() * @ignore * */ public function validate($field, $input, array $params = array()) { try { if ($input == '' || empty($params['0'])) { return false; } $params = $params['0']; if (empty($params['dropbox_access_token']) || empty($params['dropbox_app_secret'])) { return false; } $client = m62Dropbox::getRemoteClient($params['dropbox_access_token'], $params['dropbox_app_secret']); $adapter = new m62Dropbox($client); $filesystem = new Remote($adapter); if (!$filesystem->getAdapter()->listContents()) { return false; } return true; } catch (\Exception $e) { $this->setErrorMessage($e->getMessage()); return false; } }
public function testConnect() { $creds = $this->getDropboxCreds(); $s3 = Dropbox::getRemoteClient($creds['dropbox_access_token'], $creds['dropbox_app_secret']); $this->assertInstanceOf('Dropbox\\Client', $s3); }