diff --git a/lib/SP/DataModel/UserData.php b/lib/SP/DataModel/UserData.php
index dd700245..ffcd5258 100644
--- a/lib/SP/DataModel/UserData.php
+++ b/lib/SP/DataModel/UserData.php
@@ -35,115 +35,36 @@ defined('APP_ROOT') || die();
*/
class UserData extends UserPassData implements DataModelInterface
{
- /**
- * @var string
- */
- public $login;
- /**
- * @var string
- */
- public $ssoLogin;
- /**
- * @var string
- */
- public $name;
- /**
- * @var string
- */
- public $email;
- /**
- * @var string
- */
- public $notes;
- /**
- * @var int
- */
- public $userGroupId = 0;
- /**
- * @var int
- */
- public $userProfileId = 0;
- /**
- * @var bool
- */
- public $isAdminApp = 0;
- /**
- * @var bool
- */
- public $isAdminAcc = 0;
- /**
- * @var bool
- */
- public $isDisabled = 0;
- /**
- * @var bool
- */
- public $isChangePass = 0;
- /**
- * @var bool
- */
- public $isChangedPass = 0;
- /**
- * @var bool
- */
- public $isLdap = 0;
- /**
- * @var int
- */
- public $loginCount = 0;
- /**
- * @var string
- */
- public $lastLogin;
- /**
- * @var string
- */
- public $lastUpdate;
- /**
- * @var bool
- */
- public $isMigrate = 0;
- /**
- * @var string
- */
- public $preferences;
- /**
- * @var string
- */
- public $userGroupName;
+ public ?string $login = null;
+ public ?string $ssoLogin = null;
+ public ?string $name = null;
+ public ?string $email = null;
+ public ?string $notes = null;
+ public ?int $userGroupId = null;
+ public ?int $userProfileId = null;
+ public ?int $isAdminApp = null;
+ public bool $isAdminAcc = false;
+ public bool $isDisabled = false;
+ public bool $isChangePass = false;
+ public bool $isChangedPass = false;
+ public bool $isLdap = false;
+ public ?int $loginCount = null;
+ public ?string $lastLogin = null;
+ public ?string $lastUpdate = null;
+ public ?bool $isMigrate = false;
+ public ?string $preferences = null;
+ public ?string $userGroupName = null;
- /**
- * @return int
- */
- public function getLoginCount()
+ public function getLoginCount(): int
{
return (int)$this->loginCount;
}
- /**
- * @param int $loginCount
- */
- public function setLoginCount($loginCount)
- {
- $this->loginCount = (int)$loginCount;
- }
-
- /**
- * @return string
- */
- public function getLastLogin()
+ public function getLastLogin(): ?string
{
return $this->lastLogin;
}
- /**
- * @param string $lastLogin
- */
- public function setLastLogin($lastLogin)
- {
- $this->lastLogin = $lastLogin;
- }
-
/**
* @return string
*/
@@ -152,266 +73,142 @@ class UserData extends UserPassData implements DataModelInterface
return $this->lastUpdate;
}
- /**
- * @param string $lastUpdate
- */
- public function setLastUpdate($lastUpdate)
- {
- $this->lastUpdate = $lastUpdate;
- }
-
- /**
- * @return int
- */
- public function isMigrate()
+ public function isMigrate(): int
{
return (int)$this->isMigrate;
}
- /**
- * @param boolean $isMigrate
- */
- public function setIsMigrate($isMigrate)
- {
- $this->isMigrate = (int)$isMigrate;
- }
-
- /**
- * @return string
- */
- public function getPreferences()
+ public function getPreferences(): ?string
{
return $this->preferences;
}
- /**
- * @param string $preferences
- */
- public function setPreferences($preferences)
- {
- $this->preferences = $preferences;
- }
-
- /**
- * @return string
- */
- public function getEmail()
+ public function getEmail(): ?string
{
return $this->email;
}
- /**
- * @param string $email
- */
- public function setEmail($email)
+ public function setEmail(string $email)
{
$this->email = $email;
}
- /**
- * @return string
- */
- public function getNotes()
+ public function getNotes(): ?string
{
return $this->notes;
}
- /**
- * @param string $notes
- */
- public function setNotes($notes)
+ public function setNotes(string $notes)
{
$this->notes = $notes;
}
- /**
- * @return int
- */
- public function getUserGroupId()
+ public function getUserGroupId(): int
{
return (int)$this->userGroupId;
}
- /**
- * @param int $userGroupId
- */
- public function setUserGroupId($userGroupId)
+ public function setUserGroupId(int $userGroupId)
{
$this->userGroupId = (int)$userGroupId;
}
- /**
- * @return int
- */
- public function getUserProfileId()
+ public function getUserProfileId(): int
{
return (int)$this->userProfileId;
}
- /**
- * @param int $userProfileId
- */
- public function setUserProfileId($userProfileId)
+ public function setUserProfileId(int $userProfileId)
{
$this->userProfileId = (int)$userProfileId;
}
- /**
- * @return int
- */
- public function isAdminApp()
+ public function isAdminApp(): int
{
return (int)$this->isAdminApp;
}
- /**
- * @param boolean $isAdminApp
- */
- public function setIsAdminApp($isAdminApp)
+ public function setIsAdminApp(bool $isAdminApp)
{
- $this->isAdminApp = (int)$isAdminApp;
+ $this->isAdminApp = $isAdminApp;
}
- /**
- * @return int
- */
- public function isAdminAcc()
+ public function isAdminAcc(): int
{
return (int)$this->isAdminAcc;
}
- /**
- * @param boolean $isAdminAcc
- */
- public function setIsAdminAcc($isAdminAcc)
+ public function setIsAdminAcc(bool $isAdminAcc)
{
- $this->isAdminAcc = (int)$isAdminAcc;
+ $this->isAdminAcc = $isAdminAcc;
}
- /**
- * @return int
- */
- public function isDisabled()
+ public function isDisabled(): int
{
return (int)$this->isDisabled;
}
- /**
- * @param boolean $isDisabled
- */
- public function setIsDisabled($isDisabled)
+ public function setIsDisabled(bool $isDisabled)
{
- $this->isDisabled = (int)$isDisabled;
+ $this->isDisabled = $isDisabled;
}
- /**
- * @return int
- */
- public function isChangePass()
+ public function isChangePass(): int
{
return (int)$this->isChangePass;
}
- /**
- * @param boolean $isChangePass
- */
- public function setIsChangePass($isChangePass)
+ public function setIsChangePass(bool $isChangePass)
{
- $this->isChangePass = (int)$isChangePass;
+ $this->isChangePass = $isChangePass;
}
- /**
- * @return int
- */
- public function isLdap()
+ public function isLdap(): int
{
return (int)$this->isLdap;
}
- /**
- * @param boolean $isLdap
- */
public function setIsLdap(bool $isLdap)
{
- $this->isLdap = (int)$isLdap;
+ $this->isLdap = $isLdap;
}
- /**
- * @return string
- */
- public function getLogin()
+ public function getLogin(): ?string
{
return $this->login;
}
- /**
- * @param string $login
- */
- public function setLogin($login)
+ public function setLogin(string $login)
{
$this->login = $login;
}
- /**
- * @return string
- */
- public function getName()
+ public function getName(): ?string
{
return $this->name;
}
- /**
- * @param string $name
- */
- public function setName($name)
+ public function setName(string $name)
{
$this->name = $name;
}
- /**
- * @return string
- */
- public function getUserGroupName()
+ public function getUserGroupName(): ?string
{
return $this->userGroupName;
}
- /**
- * @param string $userGroupName
- */
- public function setUserGroupName($userGroupName)
- {
- $this->userGroupName = $userGroupName;
- }
-
- /**
- * @return int
- */
- public function isChangedPass()
+ public function isChangedPass(): int
{
return (int)$this->isChangedPass;
}
- /**
- * @param int $isChangedPass
- */
- public function setIsChangedPass($isChangedPass)
- {
- $this->isChangedPass = (int)$isChangedPass;
- }
-
- /**
- * @return string
- */
- public function getSsoLogin()
+ public function getSsoLogin(): ?string
{
return $this->ssoLogin;
}
- /**
- * @param string $ssoLogin
- */
- public function setSsoLogin($ssoLogin)
+ public function setSsoLogin(string $ssoLogin)
{
$this->ssoLogin = $ssoLogin;
}
diff --git a/lib/SP/DataModel/UserPassData.php b/lib/SP/DataModel/UserPassData.php
index 43f1b3be..aa314e0c 100644
--- a/lib/SP/DataModel/UserPassData.php
+++ b/lib/SP/DataModel/UserPassData.php
@@ -33,123 +33,64 @@ use SP\Domain\Common\Out\DataModelBase;
*/
class UserPassData extends DataModelBase
{
- /**
- * @var int
- */
- public $id = 0;
- /**
- * @var string
- */
- public $pass;
- /**
- * @var string
- */
- public $hashSalt;
- /**
- * @var string
- */
- public $mPass;
- /**
- * @var string
- */
- public $mKey;
- /**
- * @var int
- */
- public $lastUpdateMPass = 0;
+ protected ?int $id = null;
+ protected ?string $pass = null;
+ protected ?string $hashSalt = null;
+ protected ?string $mPass = null;
+ protected ?string $mKey = null;
+ protected ?int $lastUpdateMPass = null;
- /**
- * @return string
- */
- public function getPass()
+ public function getPass(): ?string
{
return $this->pass;
}
- /**
- * @param string $pass
- */
- public function setPass($pass)
+ public function setPass(string $pass)
{
$this->pass = $pass;
}
- /**
- * @return string
- */
- public function getHashSalt()
+ public function getHashSalt(): ?string
{
return $this->hashSalt;
}
- /**
- * @param string $hashSalt
- */
- public function setHashSalt($hashSalt)
- {
- $this->hashSalt = $hashSalt;
- }
-
- /**
- * @return string
- */
- public function getMPass()
+ public function getMPass(): ?string
{
return $this->mPass;
}
- /**
- * @param string $mPass
- */
- public function setMPass($mPass)
+ public function setMPass(string $mPass)
{
$this->mPass = $mPass;
}
- /**
- * @return string
- */
- public function getMKey()
+ public function getMKey(): ?string
{
return $this->mKey;
}
- /**
- * @param string $mKey
- */
- public function setMKey($mKey)
+ public function setMKey(string $mKey)
{
$this->mKey = $mKey;
}
- /**
- * @return int
- */
- public function getLastUpdateMPass()
+ public function getLastUpdateMPass(): int
{
return (int)$this->lastUpdateMPass;
}
- /**
- * @param int $lastUpdateMPass
- */
- public function setLastUpdateMPass($lastUpdateMPass)
+ public function setLastUpdateMPass(int $lastUpdateMPass)
{
$this->lastUpdateMPass = (int)$lastUpdateMPass;
}
- /**
- * @return int
- */
- public function getId()
+ public function getId(): ?int
{
return (int)$this->id;
}
- /**
- * @param int $id
- */
- public function setId($id)
+ public function setId(int $id)
{
$this->id = (int)$id;
}
diff --git a/lib/SP/DataModel/UserProfileData.php b/lib/SP/DataModel/UserProfileData.php
index 141be4e5..75d0a12d 100644
--- a/lib/SP/DataModel/UserProfileData.php
+++ b/lib/SP/DataModel/UserProfileData.php
@@ -36,23 +36,14 @@ defined('APP_ROOT') || die();
*/
class UserProfileData extends DataModelBase implements DataModelInterface
{
- /**
- * @var int
- */
- public $id = 0;
- /**
- * @var string
- */
- public $name = '';
- /**
- * @var ProfileData
- */
- public $profile;
+ protected ?int $id = null;
+ protected ?string $name = null;
+ protected ?ProfileData $profile = null;
/**
- * @return string
+ * @return string|null
*/
- public function getName()
+ public function getName(): ?string
{
return $this->name;
}
@@ -66,9 +57,9 @@ class UserProfileData extends DataModelBase implements DataModelInterface
}
/**
- * @return int
+ * @return int|null
*/
- public function getId()
+ public function getId(): ?int
{
return (int)$this->id;
}
diff --git a/tests/SP/Services/Backup/FileBackupServiceTest.php b/tests/SP/Domain/Export/Services/FileBackupServiceTest.php
similarity index 88%
rename from tests/SP/Services/Backup/FileBackupServiceTest.php
rename to tests/SP/Domain/Export/Services/FileBackupServiceTest.php
index 9dc9cc5a..57ea2b50 100644
--- a/tests/SP/Services/Backup/FileBackupServiceTest.php
+++ b/tests/SP/Domain/Export/Services/FileBackupServiceTest.php
@@ -22,7 +22,7 @@
* along with sysPass. If not, see .
*/
-namespace SP\Tests\Services\Backup;
+namespace SP\Tests\Domain\Export\Services;
use SP\Core\PhpExtensionChecker;
use SP\Domain\Export\Services\BackupFiles;
@@ -41,7 +41,6 @@ use SP\Tests\UnitaryTestCase;
class FileBackupServiceTest extends UnitaryTestCase
{
private FileBackupService $fileBackupService;
- private BackupFiles $backupFiles;
/**
* @throws \SP\Domain\Common\Services\ServiceException
@@ -77,18 +76,18 @@ class FileBackupServiceTest extends UnitaryTestCase
FileBackupService::BACKUP_INCLUDE_REGEX
);
- $this->backupFiles = $this->getMockBuilder(BackupFiles::class)
+ $backupFiles = $this->getMockBuilder(BackupFiles::class)
->onlyMethods(['getDbBackupArchiveHandler', 'getAppBackupArchiveHandler'])
->setConstructorArgs([new PhpExtensionChecker()])
->getMock();
- $this->backupFiles->method('getDbBackupArchiveHandler')->willReturn($archiveHandler);
- $this->backupFiles->method('getAppBackupArchiveHandler')->willReturn($archiveHandler);
+ $backupFiles->method('getDbBackupArchiveHandler')->willReturn($archiveHandler);
+ $backupFiles->method('getAppBackupArchiveHandler')->willReturn($archiveHandler);
$this->fileBackupService = new FileBackupService(
$this->application,
$database,
$this->createStub(DatabaseUtil::class),
- $this->backupFiles
+ $backupFiles
);
}
}
diff --git a/tests/SP/Services/Install/InstallerTest.php b/tests/SP/Domain/Install/Services/InstallerTest.php
similarity index 99%
rename from tests/SP/Services/Install/InstallerTest.php
rename to tests/SP/Domain/Install/Services/InstallerTest.php
index beeb0265..81f2c6e4 100644
--- a/tests/SP/Services/Install/InstallerTest.php
+++ b/tests/SP/Domain/Install/Services/InstallerTest.php
@@ -22,7 +22,7 @@
* along with sysPass. If not, see .
*/
-namespace SP\Tests\Services\Install;
+namespace SP\Tests\Domain\Install\Services;
use Exception;
use SP\Core\Exceptions\InvalidArgumentException;
diff --git a/tests/SP/Services/Install/MySQLTest.php b/tests/SP/Domain/Install/Services/MySQLTest.php
similarity index 99%
rename from tests/SP/Services/Install/MySQLTest.php
rename to tests/SP/Domain/Install/Services/MySQLTest.php
index 84b08799..9b1f5fdf 100644
--- a/tests/SP/Services/Install/MySQLTest.php
+++ b/tests/SP/Domain/Install/Services/MySQLTest.php
@@ -22,7 +22,7 @@
* along with sysPass. If not, see .
*/
-namespace SP\Tests\Services\Install;
+namespace SP\Tests\Domain\Install\Services;
use PDOException;
use SP\Core\Exceptions\SPException;
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index 2fc4867e..8d80bd9c 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -1,4 +1,27 @@
+
+
./SP/Modules/Cli
- ./SP/Services/Install
- ./SP/Services/Backup
+ ./SP/Domain
+ ./SP/Infrastructure