Merge pull request #92 from righel/fix-tests-and-notices

Fix tests and notices
pull/93/head
Andras Iklody 2022-03-02 16:41:00 +01:00 committed by GitHub
commit 4916c94de8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 7 deletions

View File

@ -19,9 +19,10 @@
"cakephp/bake": "^2.0.3",
"cakephp/cakephp-codesniffer": "~4.0.0",
"cakephp/debug_kit": "^4.0",
"cebe/php-openapi": "^1.6",
"fzaninotto/faker": "^1.9",
"josegonzalez/dotenv": "^3.2",
"league/openapi-psr7-validator": "^0.16.4",
"league/openapi-psr7-validator": "^0.17",
"phpunit/phpunit": "^8.5",
"psy/psysh": "@stable",
"wiremock-php/wiremock-php": "^2.32"
@ -65,4 +66,4 @@
"sort-packages": true
},
"minimum-stability": "dev"
}
}

View File

@ -159,9 +159,9 @@ class LocalToolInboxProcessor extends GenericInboxProcessor
{
return $validator
->requirePresence('connectorName')
->notEmpty('connectorName', 'The connector name must be provided')
->notEmptyString('connectorName', 'The connector name must be provided')
->requirePresence('cerebrateURL')
->notEmpty('cerebrateURL', 'A url must be provided')
->notEmptyString('cerebrateURL', 'A url must be provided')
->requirePresence('local_tool_id')
->numeric('local_tool_id', 'A local_tool_id must be provided')
->requirePresence('remote_tool_id')

View File

@ -37,13 +37,13 @@ class RegistrationProcessor extends UserInboxProcessor implements GenericInboxPr
protected function addValidatorRules($validator)
{
return $validator
->notEmpty('username', 'A username must be provided.')
->notEmptyString('username', 'A username must be provided.')
->add('email', 'validFormat', [
'rule' => 'email',
'message' => 'E-mail must be valid'
])
->notEmpty('first_name', 'A first name must be provided')
->notEmpty('last_name', 'A last name must be provided')
->notEmptyString('first_name', 'A first name must be provided')
->notEmptyString('last_name', 'A last name must be provided')
->add('password', 'password_complexity', [
'rule' => function($value, $context) {
if (!preg_match('/^((?=.*\d)|(?=.*\W+))(?![\n])(?=.*[A-Z])(?=.*[a-z]).*$|.{16,}/s', $value) || strlen($value) < 12) {

View File

@ -113,6 +113,7 @@ class SharingGroupsController extends AppController
public function delete($id)
{
$currentUser = $this->ACL->getUser();
$params = [];
if (empty($currentUser['role']['perm_admin'])) {
$params['conditions'] = ['organisation_id' => $currentUser['organisation_id']];
}

View File

@ -56,6 +56,7 @@ trait ApiTestTrait
// somehow this is not set automatically in test environment
$_SERVER['HTTP_AUTHORIZATION'] = $authToken;
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$this->configRequest([
'headers' => [