1
0
Fork 0
mirror of synced 2024-06-30 12:10:51 +12:00

Merge branch '0.7.x' of github.com:appwrite/appwrite into swoole-and-functions

This commit is contained in:
Eldad Fux 2020-10-30 07:52:12 +02:00
commit 33d13d91e1
36 changed files with 82 additions and 82 deletions

View file

@ -489,7 +489,7 @@ App::get('/v1/functions/:functionId/tags/:tagId')
$tag = $projectDB->getDocument($tagId); $tag = $projectDB->getDocument($tagId);
if($tag->getAttribute('functionId') !== $function->getId()) { if ($tag->getAttribute('functionId') !== $function->getId()) {
throw new Exception('Tag not found', 404); throw new Exception('Tag not found', 404);
} }
@ -519,7 +519,7 @@ App::delete('/v1/functions/:functionId/tags/:tagId')
$tag = $projectDB->getDocument($tagId); $tag = $projectDB->getDocument($tagId);
if($tag->getAttribute('functionId') !== $function->getId()) { if ($tag->getAttribute('functionId') !== $function->getId()) {
throw new Exception('Tag not found', 404); throw new Exception('Tag not found', 404);
} }
@ -575,7 +575,7 @@ App::post('/v1/functions/:functionId/executions')
$tag = $projectDB->getDocument($function->getAttribute('tag')); $tag = $projectDB->getDocument($function->getAttribute('tag'));
if($tag->getAttribute('functionId') !== $function->getId()) { if ($tag->getAttribute('functionId') !== $function->getId()) {
throw new Exception('Tag not found. Deploy tag before trying to execute a function', 404); throw new Exception('Tag not found. Deploy tag before trying to execute a function', 404);
} }
@ -673,7 +673,7 @@ App::get('/v1/functions/:functionId/executions/:executionId')
$execution = $projectDB->getDocument($executionId); $execution = $projectDB->getDocument($executionId);
if($execution->getAttribute('functionId') !== $function->getId()) { if ($execution->getAttribute('functionId') !== $function->getId()) {
throw new Exception('Execution not found', 404); throw new Exception('Execution not found', 404);
} }

View file

@ -47,7 +47,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo
$route = $utopia->match($request); $route = $utopia->match($request);
if(!empty($route->getLabel('sdk.platform', [])) && empty($project->getId()) && ($route->getLabel('scope', '') !== 'public')) { if (!empty($route->getLabel('sdk.platform', [])) && empty($project->getId()) && ($route->getLabel('scope', '') !== 'public')) {
throw new Exception('Missing or unknown project ID', 400); throw new Exception('Missing or unknown project ID', 400);
} }
@ -102,8 +102,8 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo
* @see https://www.owasp.org/index.php/List_of_useful_HTTP_headers * @see https://www.owasp.org/index.php/List_of_useful_HTTP_headers
*/ */
if (App::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled') === 'enabled') { // Force HTTPS if (App::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled') === 'enabled') { // Force HTTPS
if($request->getProtocol() !== 'https') { if ($request->getProtocol() !== 'https') {
return $response->redirect('https://'.$request->getHostname().$request->getURI()); return $response->redirect('https://'.$request->getHostname().$request->getURI());
} }
$response->addHeader('Strict-Transport-Security', 'max-age='.(60 * 60 * 24 * 126)); // 126 days $response->addHeader('Strict-Transport-Security', 'max-age='.(60 * 60 * 24 * 126)); // 126 days
@ -129,11 +129,11 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo
$origin = $request->getOrigin($request->getReferer('')); $origin = $request->getOrigin($request->getReferer(''));
$originValidator = new Origin(\array_merge($project->getAttribute('platforms', []), $console->getAttribute('platforms', []))); $originValidator = new Origin(\array_merge($project->getAttribute('platforms', []), $console->getAttribute('platforms', [])));
if(!$originValidator->isValid($origin) if (!$originValidator->isValid($origin)
&& \in_array($request->getMethod(), [Request::METHOD_POST, Request::METHOD_PUT, Request::METHOD_PATCH, Request::METHOD_DELETE]) && \in_array($request->getMethod(), [Request::METHOD_POST, Request::METHOD_PUT, Request::METHOD_PATCH, Request::METHOD_DELETE])
&& $route->getLabel('origin', false) !== '*' && $route->getLabel('origin', false) !== '*'
&& empty($request->getHeader('x-appwrite-key', ''))) { && empty($request->getHeader('x-appwrite-key', ''))) {
throw new Exception($originValidator->getDescription(), 403); throw new Exception($originValidator->getDescription(), 403);
} }
/* /*
@ -186,7 +186,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $user, $lo
Authorization::setDefaultStatus(false); // Cancel security segmentation for API keys. Authorization::setDefaultStatus(false); // Cancel security segmentation for API keys.
} }
if($user->getId()) { if ($user->getId()) {
Authorization::setRole('user:'.$user->getId()); Authorization::setRole('user:'.$user->getId());
} }
@ -301,7 +301,7 @@ App::shutdown(function ($utopia, $request, $response, $project, $webhooks, $audi
$route = $utopia->match($request); $route = $utopia->match($request);
if($project->getId() if ($project->getId()
&& $mode !== APP_MODE_ADMIN && $mode !== APP_MODE_ADMIN
&& !empty($route->getLabel('sdk.namespace', null))) { // Don't calculate console usage and admin mode && !empty($route->getLabel('sdk.namespace', null))) { // Don't calculate console usage and admin mode
@ -340,7 +340,7 @@ App::error(function ($error, $utopia, $request, $response, $layout, $project) {
$route = $utopia->match($request); $route = $utopia->match($request);
$template = ($route) ? $route->getLabel('error', null) : null; $template = ($route) ? $route->getLabel('error', null) : null;
if(php_sapi_name() === 'cli') { if (php_sapi_name() === 'cli') {
Console::error('[Error] Method: '.$route->getMethod()); Console::error('[Error] Method: '.$route->getMethod());
Console::error('[Error] URL: '.$route->getURL()); Console::error('[Error] URL: '.$route->getURL());
Console::error('[Error] Type: '.get_class($error)); Console::error('[Error] Type: '.get_class($error));
@ -413,7 +413,6 @@ App::error(function ($error, $utopia, $request, $response, $layout, $project) {
$response->dynamic(new Document($output), $response->dynamic(new Document($output),
$utopia->isDevelopment() ? Response::MODEL_ERROR_DEV : Response::MODEL_LOCALE); $utopia->isDevelopment() ? Response::MODEL_ERROR_DEV : Response::MODEL_LOCALE);
}, ['error', 'utopia', 'request', 'response', 'layout', 'project']); }, ['error', 'utopia', 'request', 'response', 'layout', 'project']);
App::get('/manifest.json') App::get('/manifest.json')
@ -469,25 +468,25 @@ App::get('/.well-known/acme-challenge')
$path = \str_replace('/.well-known/acme-challenge/', '', $request->getParam('q')); $path = \str_replace('/.well-known/acme-challenge/', '', $request->getParam('q'));
$absolute = \realpath($base.'/.well-known/acme-challenge/'.$path); $absolute = \realpath($base.'/.well-known/acme-challenge/'.$path);
if(!$base) { if (!$base) {
throw new Exception('Storage error', 500); throw new Exception('Storage error', 500);
} }
if(!$absolute) { if (!$absolute) {
throw new Exception('Unknown path', 404); throw new Exception('Unknown path', 404);
} }
if(!\substr($absolute, 0, \strlen($base)) === $base) { if (!\substr($absolute, 0, \strlen($base)) === $base) {
throw new Exception('Invalid path', 401); throw new Exception('Invalid path', 401);
} }
if(!\file_exists($absolute)) { if (!\file_exists($absolute)) {
throw new Exception('Unknown path', 404); throw new Exception('Unknown path', 404);
} }
$content = @\file_get_contents($absolute); $content = @\file_get_contents($absolute);
if(!$content) { if (!$content) {
throw new Exception('Failed to get contents', 500); throw new Exception('Failed to get contents', 500);
} }
@ -497,6 +496,6 @@ App::get('/.well-known/acme-challenge')
include_once __DIR__ . '/shared/api.php'; include_once __DIR__ . '/shared/api.php';
include_once __DIR__ . '/shared/web.php'; include_once __DIR__ . '/shared/web.php';
foreach(Config::getParam('services', []) as $service) { foreach (Config::getParam('services', []) as $service) {
include_once $service['controller']; include_once $service['controller'];
} }

View file

@ -385,10 +385,9 @@ App::get('/console/version')
try { try {
$version = \json_decode(@\file_get_contents(App::getEnv('_APP_HOME', 'http://localhost').'/v1/health/version'), true); $version = \json_decode(@\file_get_contents(App::getEnv('_APP_HOME', 'http://localhost').'/v1/health/version'), true);
if($version && isset($version['version'])) { if ($version && isset($version['version'])) {
return $response->json(['version' => $version['version']]); return $response->json(['version' => $version['version']]);
} } else {
else {
throw new Exception('Failed to check for a newer version', 500); throw new Exception('Failed to check for a newer version', 500);
} }
} catch (\Throwable $th) { } catch (\Throwable $th) {

View file

@ -9,9 +9,14 @@ use Appwrite\Auth\OAuth2;
class Box extends OAuth2 class Box extends OAuth2
{ {
/**
* @var string
*/
private $endpoint = 'https://account.box.com/api/oauth2/'; private $endpoint = 'https://account.box.com/api/oauth2/';
/**
* @var string
*/
private $resourceEndpoint = 'https://api.box.com/2.0/'; private $resourceEndpoint = 'https://api.box.com/2.0/';
/** /**
@ -19,6 +24,9 @@ class Box extends OAuth2
*/ */
protected $user = []; protected $user = [];
/**
* @var array
*/
protected $scopes = [ protected $scopes = [
'manage_app_users', 'manage_app_users',
]; ];
@ -148,5 +156,4 @@ class Box extends OAuth2
return $this->user; return $this->user;
} }
} }

View file

@ -125,7 +125,7 @@ class Github extends OAuth2
* @return array * @return array
*/ */
protected function getUser(string $accessToken) protected function getUser(string $accessToken)
{ {
if (empty($this->user)) { if (empty($this->user)) {
$this->user = \json_decode($this->request('GET', 'https://api.github.com/user', ['Authorization: token '.\urlencode($accessToken)]), true); $this->user = \json_decode($this->request('GET', 'https://api.github.com/user', ['Authorization: token '.\urlencode($accessToken)]), true);
} }

View file

@ -232,7 +232,7 @@ class MySQL extends Adapter
// Handle array of relations // Handle array of relations
if (self::DATA_TYPE_ARRAY === $type) { if (self::DATA_TYPE_ARRAY === $type) {
if(!is_array($value)) { // Property should be of type array, if not = skip if (!is_array($value)) { // Property should be of type array, if not = skip
continue; continue;
} }

View file

@ -458,7 +458,7 @@ class Database
$filters = $rule->getAttribute('filter', null); $filters = $rule->getAttribute('filter', null);
$value = $document->getAttribute($key, null); $value = $document->getAttribute($key, null);
if(($value !== null) && is_array($filters)) { if (($value !== null) && is_array($filters)) {
foreach ($filters as $filter) { foreach ($filters as $filter) {
$value = $this->encodeAttribute($filter, $value); $value = $this->encodeAttribute($filter, $value);
$document->setAttribute($key, $value); $document->setAttribute($key, $value);
@ -479,7 +479,7 @@ class Database
$filters = $rule->getAttribute('filter', null); $filters = $rule->getAttribute('filter', null);
$value = $document->getAttribute($key, null); $value = $document->getAttribute($key, null);
if(($value !== null) && is_array($filters)) { if (($value !== null) && is_array($filters)) {
foreach (array_reverse($filters) as $filter) { foreach (array_reverse($filters) as $filter) {
$value = $this->decodeAttribute($filter, $value); $value = $this->decodeAttribute($filter, $value);
$document->setAttribute($key, $value); $document->setAttribute($key, $value);
@ -498,7 +498,7 @@ class Database
*/ */
static protected function encodeAttribute(string $name, $value) static protected function encodeAttribute(string $name, $value)
{ {
if(!isset(self::$filters[$name])) { if (!isset(self::$filters[$name])) {
throw new Exception('Filter not found'); throw new Exception('Filter not found');
} }
@ -519,7 +519,7 @@ class Database
*/ */
static protected function decodeAttribute(string $name, $value) static protected function decodeAttribute(string $name, $value)
{ {
if(!isset(self::$filters[$name])) { if (!isset(self::$filters[$name])) {
throw new Exception('Filter not found'); throw new Exception('Filter not found');
} }

View file

@ -219,7 +219,7 @@ class Document extends ArrayObject
{ {
$array = parent::getArrayCopy(); $array = parent::getArrayCopy();
$output = array(); $output = [];
foreach ($array as $key => &$value) { foreach ($array as $key => &$value) {
if (!empty($whitelist) && !\in_array($key, $whitelist)) { // Export only whitelisted fields if (!empty($whitelist) && !\in_array($key, $whitelist)) { // Export only whitelisted fields

View file

@ -157,7 +157,7 @@ class Structure extends Validator
foreach ($array as $key => $value) { foreach ($array as $key => $value) {
$rule = $collection->search('key', $key, $rules); $rule = $collection->search('key', $key, $rules);
if(!$rule) { if (!$rule) {
continue; continue;
} }

View file

@ -37,7 +37,7 @@ class UID extends Validator
return false; return false;
} }
if(mb_strlen($value) > 32) { if (mb_strlen($value) > 32) {
return false; return false;
} }

View file

@ -48,7 +48,7 @@ class Compose
*/ */
public function getService(string $name): Service public function getService(string $name): Service
{ {
if(!isset($this->compose['services'][$name])) { if (!isset($this->compose['services'][$name])) {
throw new Exception('Service not found'); throw new Exception('Service not found');
} }

View file

@ -16,15 +16,14 @@ class Env
*/ */
public function __construct(string $data) public function __construct(string $data)
{ {
$data = explode("\n", $data); $data = explode("\n", $data);
foreach($data as &$row) { foreach ($data as &$row) {
$row = explode('=', $row); $row = explode('=', $row);
$key = (isset($row[0])) ? trim($row[0]) : null; $key = (isset($row[0])) ? trim($row[0]) : null;
$value = (isset($row[1])) ? trim($row[1]) : null; $value = (isset($row[1])) ? trim($row[1]) : null;
if($key) { if ($key) {
$this->vars[$key] = $value; $this->vars[$key] = $value;
} }
} }

View file

@ -73,15 +73,15 @@ class PDOStatement extends PDOStatementNative
$this->pdo = $this->pdo->reconnect(); $this->pdo = $this->pdo->reconnect();
$this->PDOStatement = $this->pdo->prepare($this->PDOStatement->queryString, []); $this->PDOStatement = $this->pdo->prepare($this->PDOStatement->queryString, []);
foreach($this->values as $key => $set) { foreach ($this->values as $key => $set) {
$this->PDOStatement->bindValue($key, $set['value'], $set['data_type']); $this->PDOStatement->bindValue($key, $set['value'], $set['data_type']);
} }
foreach($this->params as $key => $set) { foreach ($this->params as $key => $set) {
$this->PDOStatement->bindParam($key, $set['variable'], $set['data_type'], $set['length'], $set['driver_options']); $this->PDOStatement->bindParam($key, $set['variable'], $set['data_type'], $set['length'], $set['driver_options']);
} }
foreach($this->columns as $key => $set) { foreach ($this->columns as $key => $set) {
$this->PDOStatement->bindColumn($key, $set['param'], $set['type'], $set['maxlen'], $set['driverdata']); $this->PDOStatement->bindColumn($key, $set['param'], $set['type'], $set['maxlen'], $set['driverdata']);
} }

View file

@ -36,7 +36,7 @@ class CNAME extends Validator
*/ */
public function isValid($domain) public function isValid($domain)
{ {
if(!is_string($domain)) { if (!is_string($domain)) {
return false; return false;
} }

View file

@ -37,11 +37,11 @@ class Domain extends Validator
*/ */
public function isValid($value) public function isValid($value)
{ {
if(empty($value)) { if (empty($value)) {
return false; return false;
} }
if(!is_string($value)) { if (!is_string($value)) {
return false; return false;
} }

View file

@ -99,7 +99,7 @@ class Origin extends Validator
*/ */
public function isValid($origin) public function isValid($origin)
{ {
if(!is_string($origin)) { if (!is_string($origin)) {
return false; return false;
} }

View file

@ -13,7 +13,7 @@ class Storage
* *
* @var array * @var array
*/ */
public static $devices = array(); public static $devices = [];
/** /**
* Set Device. * Set Device.

View file

@ -24,7 +24,7 @@ class FileName extends Validator
return false; return false;
} }
if(!is_string($name)) { if (!is_string($name)) {
return false; return false;
} }

View file

@ -35,7 +35,7 @@ class FileSize extends Validator
*/ */
public function isValid($fileSize) public function isValid($fileSize)
{ {
if(!is_int($fileSize)) { if (!is_int($fileSize)) {
return false; return false;
} }

View file

@ -20,7 +20,7 @@ class Upload extends Validator
*/ */
public function isValid($path) public function isValid($path)
{ {
if(!is_string($path)) { if (!is_string($path)) {
return false; return false;
} }

View file

@ -30,7 +30,7 @@ class Cron extends Validator
*/ */
public function isValid($value) public function isValid($value)
{ {
if(empty($value)) { if (empty($value)) {
return true; return true;
} }

View file

@ -205,7 +205,7 @@ class Response extends SwooleResponse
*/ */
public function getModel(string $key): Model public function getModel(string $key): Model
{ {
if(!isset($this->models[$key])) { if (!isset($this->models[$key])) {
throw new Exception('Undefined model: '.$key); throw new Exception('Undefined model: '.$key);
} }
@ -230,28 +230,27 @@ class Response extends SwooleResponse
$model = $this->getModel($model); $model = $this->getModel($model);
$output = []; $output = [];
if($model->isAny()) { if ($model->isAny()) {
return $document->getArrayCopy(); return $document->getArrayCopy();
} }
foreach($model->getRules() as $key => $rule) { foreach ($model->getRules() as $key => $rule) {
if(!$document->isSet($key)) { if (!$document->isSet($key)) {
if(!is_null($rule['default'])) { if (!is_null($rule['default'])) {
$document->setAttribute($key, $rule['default']); $document->setAttribute($key, $rule['default']);
} } else {
else {
throw new Exception('Model '.$model->getName().' is missing response key: '.$key); throw new Exception('Model '.$model->getName().' is missing response key: '.$key);
} }
} }
if($rule['array']) { if ($rule['array']) {
if(!is_array($data[$key])) { if (!is_array($data[$key])) {
throw new Exception($key.' must be an array of type '.$rule['type']); throw new Exception($key.' must be an array of type '.$rule['type']);
} }
foreach ($data[$key] as &$item) { foreach ($data[$key] as &$item) {
if($item instanceof Document) { if ($item instanceof Document) {
if(!array_key_exists($rule['type'], $this->models)) { if (!array_key_exists($rule['type'], $this->models)) {
throw new Exception('Missing model for rule: '. $rule['type']); throw new Exception('Missing model for rule: '. $rule['type']);
} }
@ -282,7 +281,7 @@ class Response extends SwooleResponse
*/ */
public function yaml(array $data): void public function yaml(array $data): void
{ {
if(!extension_loaded('yaml')) { if (!extension_loaded('yaml')) {
throw new Exception('Missing yaml extension. Learn more at: https://www.php.net/manual/en/book.yaml.php'); throw new Exception('Missing yaml extension. Learn more at: https://www.php.net/manual/en/book.yaml.php');
} }

View file

@ -22,7 +22,7 @@ class BaseList extends Model
$this->name = $name; $this->name = $name;
$this->type = $type; $this->type = $type;
if($paging) { if ($paging) {
$this->addRule('sum', [ $this->addRule('sum', [
'type' => 'integer', 'type' => 'integer',
'description' => 'Total sum of items in the list.', 'description' => 'Total sum of items in the list.',

View file

@ -218,7 +218,7 @@ class Client
case 'application/json': case 'application/json':
$json = json_decode($responseBody, true); $json = json_decode($responseBody, true);
if($json === null) { if ($json === null) {
throw new Exception('Failed to parse response: '.$responseBody); throw new Exception('Failed to parse response: '.$responseBody);
} }
@ -235,7 +235,7 @@ class Client
$responseHeaders['status-code'] = $responseStatus; $responseHeaders['status-code'] = $responseStatus;
if($responseStatus === 500) { if ($responseStatus === 500) {
echo 'Server error('.$method.': '.$path.'. Params: '.json_encode($params).'): '.json_encode($responseBody)."\n"; echo 'Server error('.$method.': '.$path.'. Params: '.json_encode($params).'): '.json_encode($responseBody)."\n";
} }

View file

@ -16,7 +16,7 @@ trait ProjectCustom
*/ */
public function getProject(): array public function getProject(): array
{ {
if(!empty(self::$project)) { if (!empty(self::$project)) {
return self::$project; return self::$project;
} }

View file

@ -37,7 +37,7 @@ abstract class Scope extends TestCase
$emails = json_decode(file_get_contents('http://maildev/email'), true); $emails = json_decode(file_get_contents('http://maildev/email'), true);
if($emails && is_array($emails)) { if ($emails && is_array($emails)) {
return end($emails); return end($emails);
} }
@ -74,7 +74,7 @@ abstract class Scope extends TestCase
*/ */
public function getRoot(): array public function getRoot(): array
{ {
if((self::$root)) { if ((self::$root)) {
return self::$root; return self::$root;
} }
@ -125,7 +125,7 @@ abstract class Scope extends TestCase
*/ */
public function getUser(): array public function getUser(): array
{ {
if(isset(self::$user[$this->getProject()['$id']])) { if (isset(self::$user[$this->getProject()['$id']])) {
return self::$user[$this->getProject()['$id']]; return self::$user[$this->getProject()['$id']];
} }

View file

@ -6,5 +6,4 @@ use Tests\E2E\Client;
trait HealthBase trait HealthBase
{ {
} }

View file

@ -6,5 +6,4 @@ use Tests\E2E\Client;
trait ProjectsBase trait ProjectsBase
{ {
} }

View file

@ -139,7 +139,7 @@ class ProjectsConsoleClientTest extends Scope
$this->assertEquals(400, $response['headers']['status-code']); $this->assertEquals(400, $response['headers']['status-code']);
return $data; return $data;
} }
/** /**
@ -198,7 +198,7 @@ class ProjectsConsoleClientTest extends Scope
$this->assertEquals(400, $response['headers']['status-code']); $this->assertEquals(400, $response['headers']['status-code']);
return $data; return $data;
} }
/** /**
@ -256,7 +256,7 @@ class ProjectsConsoleClientTest extends Scope
* Test for SUCCESS * Test for SUCCESS
*/ */
foreach($providers as $key => $provider) { foreach ($providers as $key => $provider) {
$response = $this->client->call(Client::METHOD_PATCH, '/projects/'.$id.'/oauth2', array_merge([ $response = $this->client->call(Client::METHOD_PATCH, '/projects/'.$id.'/oauth2', array_merge([
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
@ -279,7 +279,7 @@ class ProjectsConsoleClientTest extends Scope
$this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']);
$this->assertEquals($id, $response['body']['$id']); $this->assertEquals($id, $response['body']['$id']);
foreach($providers as $key => $provider) { foreach ($providers as $key => $provider) {
$this->assertEquals('AppId-'.ucfirst($key), $response['body']['usersOauth2'.ucfirst($key).'Appid']); $this->assertEquals('AppId-'.ucfirst($key), $response['body']['usersOauth2'.ucfirst($key).'Appid']);
$this->assertEquals('Secret-'.ucfirst($key), $response['body']['usersOauth2'.ucfirst($key).'Secret']); $this->assertEquals('Secret-'.ucfirst($key), $response['body']['usersOauth2'.ucfirst($key).'Secret']);
} }

View file

@ -96,7 +96,7 @@ trait TeamsBase
* Test for FAILURE * Test for FAILURE
*/ */
return []; return [];
} }
/** /**
@ -171,7 +171,7 @@ trait TeamsBase
* Test for FAILURE * Test for FAILURE
*/ */
return []; return [];
} }
public function testUpdateTeam():array public function testUpdateTeam():array

View file

@ -32,7 +32,7 @@ trait TeamsBaseClient
* Test for FAILURE * Test for FAILURE
*/ */
return $data; return $data;
} }
/** /**

View file

@ -28,7 +28,7 @@ trait TeamsBaseServer
* Test for FAILURE * Test for FAILURE
*/ */
return []; return [];
} }

View file

@ -18,7 +18,7 @@ class ComposeTest extends TestCase
{ {
$data = @file_get_contents(__DIR__.'/../../resources/docker/docker-compose.yml'); $data = @file_get_contents(__DIR__.'/../../resources/docker/docker-compose.yml');
if($data === false) { if ($data === false) {
throw new Exception('Failed to read compose file'); throw new Exception('Failed to read compose file');
} }

View file

@ -18,7 +18,7 @@ class EnvTest extends TestCase
{ {
$data = @file_get_contents(__DIR__.'/../../resources/docker/.env'); $data = @file_get_contents(__DIR__.'/../../resources/docker/.env');
if($data === false) { if ($data === false) {
throw new Exception('Failed to read compose file'); throw new Exception('Failed to read compose file');
} }

View file

@ -60,6 +60,5 @@ class OriginTest extends TestCase
$this->assertEquals($validator->isValid('appwrite-windows://com.company.appname'), false); $this->assertEquals($validator->isValid('appwrite-windows://com.company.appname'), false);
$this->assertEquals($validator->getDescription(), 'Invalid Origin. Register your new client (com.company.appname) as a new Windows platform on your project console dashboard'); $this->assertEquals($validator->getDescription(), 'Invalid Origin. Register your new client (com.company.appname) as a new Windows platform on your project console dashboard');
} }
} }

View file

@ -28,7 +28,7 @@ class StorageTest extends TestCase
try { try {
get_class(Storage::getDevice('disk-c')); get_class(Storage::getDevice('disk-c'));
$this->fail("Expected exception not thrown"); $this->fail("Expected exception not thrown");
} catch(Exception $e) { } catch (Exception $e) {
$this->assertEquals('The device "disk-c" is not listed', $e->getMessage()); $this->assertEquals('The device "disk-c" is not listed', $e->getMessage());
} }
} }