user and test fixes

This commit is contained in:
yuri
2018-10-26 13:23:03 +03:00
parent 1f5baa9d70
commit adf5283375
5 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ class User extends \Espo\Core\Entities\Person
public function isRegular()
{
return $this->get('type') === 'regular';
return $this->get('type') === 'regular' || ($this->has('type') && !$this->get('type'));
}
public function isApi()
+1 -1
View File
@@ -296,7 +296,7 @@ class Tester
$userData['password'] = $passwordHash->hash($userData['password']);
if ($isPortal) {
$userData['isPortalUser'] = true;
$userData['type'] = 'portal';
}
$user = $entityManager->getEntity('User');
+2 -2
View File
@@ -197,14 +197,14 @@ class AclTest extends \tests\integration\Core\BaseTestCase
];
$data = [
'id' => $user1->id,
'isAdmin' => 1,
'type' => 'admin',
'teamsIds' => ['id']
];
$request = $this->createRequest('PATCH', $params, ['CONTENT_TYPE' => 'application/json']);
$result = $controllerManager->process('User', 'update', $params, json_encode($data), $request);
$resultData = json_decode($result);
$this->assertTrue(!property_exists($resultData, 'isAdmin') || !$resultData->isAdmin);
$this->assertTrue(!property_exists($resultData, 'type') || $resultData->type !== 'admin');
$this->assertTrue(
!property_exists($resultData, 'teamsIds') || !is_array($resultData->teamsIds) || !in_array('id', $$resultData->teamsIds)
);
+1
View File
@@ -33,6 +33,7 @@ return array(
array(
'id' => '1',
'isAdmin' => true,
'type' => 'admin',
'userName' => 'admin',
'password' => '1',
'salutationName' => '',
@@ -33,6 +33,7 @@ return array(
array(
'id' => '1',
'isAdmin' => true,
'type' => 'admin',
'userName' => 'admin',
'password' => '1',
'salutationName' => '',