From ec4f5cabeb70ecbdfef50aa9db54168243421e4e Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 24 Nov 2020 17:31:20 +0100 Subject: [PATCH] remove some getter/setter --- Models/Category.php | 158 ++---------------------- Models/Cause.php | 70 +---------- Models/Process.php | 70 +---------- Models/Risk.php | 70 +---------- Models/RiskObject.php | 70 +---------- Models/Solution.php | 32 +---- Theme/Backend/cockpit.tpl.php | 2 +- Theme/Backend/department-single.tpl.php | 18 +-- Theme/Backend/risk-create.tpl.php | 10 +- Theme/Backend/risk-list.tpl.php | 2 +- Theme/Backend/risk-single.tpl.php | 12 +- Theme/Backend/unit-list.tpl.php | 2 +- Theme/Backend/unit-single.tpl.php | 20 +-- tests/Models/CategoryMapperTest.php | 17 +-- tests/Models/CategoryTest.php | 32 ++--- tests/Models/CauseMapperTest.php | 16 +-- tests/Models/CauseTest.php | 14 +-- tests/Models/ProcessMapperTest.php | 8 +- tests/Models/ProcessTest.php | 14 +-- tests/Models/RiskMapperTest.php | 30 ++--- tests/Models/RiskObjectMapperTest.php | 8 +- tests/Models/RiskObjectTest.php | 14 +-- tests/Models/RiskTest.php | 14 +-- tests/Models/SolutionMapperTest.php | 8 +- tests/Models/SolutionTest.php | 14 +-- 25 files changed, 151 insertions(+), 574 deletions(-) diff --git a/Models/Category.php b/Models/Category.php index 29ddf82..1058dbd 100755 --- a/Models/Category.php +++ b/Models/Category.php @@ -40,7 +40,7 @@ class Category * @var string * @since 1.0.0 */ - private $title = ''; + public string $title = ''; /** * Description. @@ -48,7 +48,7 @@ class Category * @var string * @since 1.0.0 */ - private string $description = ''; + public string $description = ''; /** * Description. @@ -56,7 +56,7 @@ class Category * @var string * @since 1.0.0 */ - private string $descriptionRaw = ''; + public string $descriptionRaw = ''; /** * Parent category. @@ -64,23 +64,23 @@ class Category * @var null|int|self * @since 1.0.0 */ - private $parent = null; + public $parent = null; /** * Responsible person * - * @var null|Account + * @var null|int * @since 1.0.0 */ - private ?Account $responsible = null; + public ?int $responsible = null; /** * Responsible person * - * @var null|Account + * @var null|int * @since 1.0.0 */ - private ?Account $deputy = null; + public ?int $deputy = null; /** * Get id. @@ -93,146 +93,4 @@ class Category { return $this->id; } - - /** - * Get parent category. - * - * @return mixed - * - * @since 1.0.0 - */ - public function getParent() - { - return $this->parent; - } - - /** - * Set parent category. - * - * @param mixed $parent Parent category - * - * @return void - * - * @since 1.0.0 - */ - public function setParent($parent) : void - { - $this->parent = $parent; - } - - /** - * Get responsible. - * - * @return mixed - * - * @since 1.0.0 - */ - public function getResponsible() - { - return $this->responsible; - } - - /** - * Set responsible. - * - * @param mixed $responsible Responsible - * - * @return void - * - * @since 1.0.0 - */ - public function setResponsible($responsible) : void - { - $this->responsible = $responsible; - } - - /** - * Set deputy. - * - * @param mixed $deputy Deputy - * - * @return void - * - * @since 1.0.0 - */ - public function setDeputy($deputy) : void - { - $this->deputy = $deputy; - } - - /** - * Get deputy. - * - * @return mixed - * - * @since 1.0.0 - */ - public function getDeputy() - { - return $this->deputy; - } - - /** - * Get title. - * - * @return string - * - * @since 1.0.0 - */ - public function getTitle() : string - { - return $this->title; - } - - /** - * Set title. - * - * @param string $title Title - * - * @return void - * - * @since 1.0.0 - */ - public function setTitle(string $title) : void - { - $this->title = $title; - } - - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() : string - { - return $this->description; - } - - /** - * Get raw description. - * - * @return string - * - * @since 1.0.0 - */ - public function getDescriptionRaw() : string - { - return $this->descriptionRaw; - } - - /** - * Set raw description - * - * @param string $description Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescriptionRaw(string $description) : void - { - $this->descriptionRaw = $description; - } } diff --git a/Models/Cause.php b/Models/Cause.php index fb28a0b..1094fb9 100755 --- a/Models/Cause.php +++ b/Models/Cause.php @@ -32,7 +32,7 @@ class Cause */ protected int $id = 0; - private $title = ''; + public string $title = ''; /** * Description. @@ -40,7 +40,7 @@ class Cause * @var string * @since 1.0.0 */ - private string $description = ''; + public string $description = ''; /** * Description. @@ -48,7 +48,7 @@ class Cause * @var string * @since 1.0.0 */ - private string $descriptionRaw = ''; + public string $descriptionRaw = ''; private $probability = 0; @@ -173,68 +173,4 @@ class Cause { $this->department = $department; } - - /** - * Get title. - * - * @return string - * - * @since 1.0.0 - */ - public function getTitle() : string - { - return $this->title; - } - - /** - * Set title. - * - * @param string $title Title - * - * @return void - * - * @since 1.0.0 - */ - public function setTitle(string $title) : void - { - $this->title = $title; - } - - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() : string - { - return $this->description; - } - - /** - * Get raw description. - * - * @return string - * - * @since 1.0.0 - */ - public function getDescriptionRaw() : string - { - return $this->descriptionRaw; - } - - /** - * Set raw description. - * - * @param string $description Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescriptionRaw(string $description) : void - { - $this->descriptionRaw = $description; - } } diff --git a/Models/Process.php b/Models/Process.php index 57d2e4f..35151bd 100755 --- a/Models/Process.php +++ b/Models/Process.php @@ -32,7 +32,7 @@ class Process */ protected int $id = 0; - private $title = ''; + public string $title = ''; /** * Description. @@ -40,7 +40,7 @@ class Process * @var string * @since 1.0.0 */ - private string $description = ''; + public string $description = ''; /** * Description. @@ -48,7 +48,7 @@ class Process * @var string * @since 1.0.0 */ - private string $descriptionRaw = ''; + public string $descriptionRaw = ''; private $department = null; @@ -70,70 +70,6 @@ class Process return $this->id; } - /** - * Get title. - * - * @return string - * - * @since 1.0.0 - */ - public function getTitle() : string - { - return $this->title; - } - - /** - * Set title. - * - * @param string $title Title - * - * @return void - * - * @since 1.0.0 - */ - public function setTitle(string $title) : void - { - $this->title = $title; - } - - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() : string - { - return $this->description; - } - - /** - * Get raw description. - * - * @return string - * - * @since 1.0.0 - */ - public function getDescriptionRaw() : string - { - return $this->descriptionRaw; - } - - /** - * Set raw description. - * - * @param string $description Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescriptionRaw(string $description) : void - { - $this->descriptionRaw = $description; - } - /** * Get unit. * diff --git a/Models/Risk.php b/Models/Risk.php index 95708e2..3f4ed24 100755 --- a/Models/Risk.php +++ b/Models/Risk.php @@ -38,7 +38,7 @@ class Risk * @var string * @since 1.0.0 */ - private string $name = ''; + public string $name = ''; /** * Description. @@ -46,7 +46,7 @@ class Risk * @var string * @since 1.0.0 */ - private string $description = ''; + public string $description = ''; /** * Description. @@ -54,7 +54,7 @@ class Risk * @var string * @since 1.0.0 */ - private string $descriptionRaw = ''; + public string $descriptionRaw = ''; private $unit = 1; @@ -234,70 +234,6 @@ class Risk return $this->histScore; } - /** - * Get name - * - * @return string - * - * @since 1.0.0 - */ - public function getName() : string - { - return $this->name; - } - - /** - * Set name - * - * @param string $name Name - * - * @return void - * - * @since 1.0.0 - */ - public function setName(string $name) : void - { - $this->name = $name; - } - - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() : string - { - return $this->description; - } - - /** - * Set raw description. - * - * @param string $description Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescriptionRaw(string $description) : void - { - $this->descriptionRaw = $description; - } - - /** - * Get raw description. - * - * @return string - * - * @since 1.0.0 - */ - public function getDescriptionRaw() : string - { - return $this->descriptionRaw; - } - /** * Get unit. * diff --git a/Models/RiskObject.php b/Models/RiskObject.php index 2a9077c..814c273 100755 --- a/Models/RiskObject.php +++ b/Models/RiskObject.php @@ -32,7 +32,7 @@ class RiskObject */ protected int $id = 0; - private $title = ''; + public string $title = ''; /** * Description. @@ -40,7 +40,7 @@ class RiskObject * @var string * @since 1.0.0 */ - private string $description = ''; + public string $description = ''; /** * Description. @@ -48,7 +48,7 @@ class RiskObject * @var string * @since 1.0.0 */ - private string $descriptionRaw = ''; + public string $descriptionRaw = ''; private $risk = null; @@ -89,68 +89,4 @@ class RiskObject { $this->risk = $risk; } - - /** - * Get title. - * - * @return string - * - * @since 1.0.0 - */ - public function getTitle() : string - { - return $this->title; - } - - /** - * Set title. - * - * @param string $title Title - * - * @return void - * - * @since 1.0.0 - */ - public function setTitle(string $title) : void - { - $this->title = $title; - } - - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() : string - { - return $this->description; - } - - /** - * Get raw description. - * - * @return string - * - * @since 1.0.0 - */ - public function getDescriptionRaw() : string - { - return $this->descriptionRaw; - } - - /** - * Set raw description. - * - * @param string $description Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescriptionRaw(string $description) : void - { - $this->descriptionRaw = $description; - } } diff --git a/Models/Solution.php b/Models/Solution.php index 4be29d6..14fb18a 100755 --- a/Models/Solution.php +++ b/Models/Solution.php @@ -32,7 +32,7 @@ class Solution */ protected int $id = 0; - private $title = ''; + public string $title = ''; /** * Description. @@ -40,7 +40,7 @@ class Solution * @var string * @since 1.0.0 */ - private string $description = ''; + public string $description = ''; /** * Description. @@ -48,7 +48,7 @@ class Solution * @var string * @since 1.0.0 */ - private string $descriptionRaw = ''; + public string $descriptionRaw = ''; private $probability = 0; @@ -146,32 +146,6 @@ class Solution $this->probability = $probability; } - /** - * Get title. - * - * @return string - * - * @since 1.0.0 - */ - public function getTitle() : string - { - return $this->title; - } - - /** - * Set title. - * - * @param string $title Title - * - * @return void - * - * @since 1.0.0 - */ - public function setTitle(string $title) : void - { - $this->title = $title; - } - /** * Get description * diff --git a/Theme/Backend/cockpit.tpl.php b/Theme/Backend/cockpit.tpl.php index 18d4a29..0842763 100755 --- a/Theme/Backend/cockpit.tpl.php +++ b/Theme/Backend/cockpit.tpl.php @@ -46,7 +46,7 @@ echo $this->getData('nav')->render(); ?> $url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/group/settings?{?}&id=' . $value->getId()); ?> printHtml($value->getId()); ?> - printHtml($value->getName()); ?> + printHtml($value->name); ?> diff --git a/Theme/Backend/department-single.tpl.php b/Theme/Backend/department-single.tpl.php index ad65215..c77333f 100755 --- a/Theme/Backend/department-single.tpl.php +++ b/Theme/Backend/department-single.tpl.php @@ -28,7 +28,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-1' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
@@ -40,7 +40,7 @@ echo $this->getData('nav')->render(); ?>
getHtml('Name'); ?>printHtml($department->getDepartment()->getName()); ?> -
getHtml('Description'); ?>:printHtml($department->getDepartment()->getDescription()); ?> +
getHtml('Description'); ?>:printHtml($department->getDepartment()->description); ?>
getHtml('Unit'); ?>:printHtml($department->getDepartment()->getUnit()->getName()); ?>
getHtml('Risks'); ?>:
getHtml('Categories'); ?>: @@ -94,7 +94,7 @@ echo $this->getData('nav')->render(); ?> - request->getUri()->getFragment() === 'c-tab-2' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
@@ -115,7 +115,7 @@ echo $this->getData('nav')->render(); ?> $url = \phpOMS\Uri\UriFactory::build('{/prefix}riskmanagement/cause/single?{?}&id=' . $value->getId()); ?>
printHtml($value->getId()); ?> - printHtml($value->getName()); ?> + printHtml($value->name); ?> printHtml(\count($value->getCauses())); ?> printHtml(\count($value->getSolutions())); ?> printHtml(\count($value->getRiskObjects())); ?> @@ -128,7 +128,7 @@ echo $this->getData('nav')->render(); ?> - request->getUri()->getFragment() === 'c-tab-3' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
@@ -156,7 +156,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-4' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
@@ -184,7 +184,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-5' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
@@ -212,7 +212,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-6' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-6' ? ' checked' : ''; ?>>
@@ -242,7 +242,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-7' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-7' ? ' checked' : ''; ?>>
diff --git a/Theme/Backend/risk-create.tpl.php b/Theme/Backend/risk-create.tpl.php index c7a8d93..5b99b7f 100755 --- a/Theme/Backend/risk-create.tpl.php +++ b/Theme/Backend/risk-create.tpl.php @@ -25,7 +25,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-1' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
@@ -99,7 +99,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-2' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
@@ -154,7 +154,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-3' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
@@ -195,7 +195,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-4' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
@@ -240,7 +240,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-5' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
diff --git a/Theme/Backend/risk-list.tpl.php b/Theme/Backend/risk-list.tpl.php index f5e1343..596915c 100755 --- a/Theme/Backend/risk-list.tpl.php +++ b/Theme/Backend/risk-list.tpl.php @@ -34,7 +34,7 @@ echo $this->getData('nav')->render(); ?> $url = \phpOMS\Uri\UriFactory::build('{/prefix}riskmanagement/risk/single?{?}&id=' . $value->getId()); ?>
printHtml($value->getId()); ?> - printHtml($value->getName()); ?> + printHtml($value->name); ?> printHtml(\count($value->getCauses())); ?> printHtml(\count($value->getSolutions())); ?> printHtml(\count($value->getRiskObjects())); ?> diff --git a/Theme/Backend/risk-single.tpl.php b/Theme/Backend/risk-single.tpl.php index 2efd5b0..76ba3b2 100755 --- a/Theme/Backend/risk-single.tpl.php +++ b/Theme/Backend/risk-single.tpl.php @@ -26,7 +26,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-1' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
@@ -38,7 +38,7 @@ echo $this->getData('nav')->render(); ?>
getHtml('Name'); ?>printHtml($risk->getName()); ?> -
getHtml('Description'); ?>printHtml($risk->getDescription()); ?> +
getHtml('Description'); ?>printHtml($risk->description); ?>
getHtml('Unit'); ?>printHtml($risk->getUnit()->getName()); ?>
getHtml('Category'); ?>printHtml($risk->getCategory()->getTitle()); ?>
getHtml('Department'); ?>printHtml($risk->getDepartment()->getDepartment()->getName()); ?> @@ -90,7 +90,7 @@ echo $this->getData('nav')->render(); ?> - request->getUri()->getFragment() === 'c-tab-2' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
@@ -145,7 +145,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-3' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
@@ -186,7 +186,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-4' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
@@ -231,7 +231,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-5' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
diff --git a/Theme/Backend/unit-list.tpl.php b/Theme/Backend/unit-list.tpl.php index ee84b2d..c5d7881 100755 --- a/Theme/Backend/unit-list.tpl.php +++ b/Theme/Backend/unit-list.tpl.php @@ -31,7 +31,7 @@ echo $this->getData('nav')->render(); ?> $url = \phpOMS\Uri\UriFactory::build('{/prefix}riskmanagement/unit/single?{?}&id=' . $value->getId()); ?>
printHtml($value->getId()); ?> - printHtml($value->getName()); ?> + printHtml($value->name); ?>
getHtml('Empty', '0', '0'); ?> diff --git a/Theme/Backend/unit-single.tpl.php b/Theme/Backend/unit-single.tpl.php index 928d629..35c8c00 100755 --- a/Theme/Backend/unit-single.tpl.php +++ b/Theme/Backend/unit-single.tpl.php @@ -29,7 +29,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-1' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
@@ -41,7 +41,7 @@ echo $this->getData('nav')->render(); ?>
getHtml('Name'); ?>printHtml($unit->getName()); ?> -
getHtml('Description'); ?>:printHtml($unit->getDescription()); ?> +
getHtml('Description'); ?>:printHtml($unit->description); ?>
getHtml('Risks'); ?>:
getHtml('Departments'); ?>:
getHtml('Categories'); ?>: @@ -95,7 +95,7 @@ echo $this->getData('nav')->render(); ?> - request->getUri()->getFragment() === 'c-tab-2' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
@@ -116,7 +116,7 @@ echo $this->getData('nav')->render(); ?> $url = \phpOMS\Uri\UriFactory::build('{/prefix}riskmanagement/cause/single?{?}&id=' . $value->getId()); ?>
printHtml($value->getId()); ?> - printHtml($value->getName()); ?> + printHtml($value->name); ?> printHtml(\count($value->getCauses())); ?> printHtml(\count($value->getSolutions())); ?> printHtml(\count($value->getRiskObjects())); ?> @@ -129,7 +129,7 @@ echo $this->getData('nav')->render(); ?> - request->getUri()->getFragment() === 'c-tab-3' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
@@ -157,7 +157,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-4' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
@@ -185,7 +185,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-5' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
@@ -213,7 +213,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-6' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-6' ? ' checked' : ''; ?>>
@@ -241,7 +241,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-7' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-7' ? ' checked' : ''; ?>>
@@ -271,7 +271,7 @@ echo $this->getData('nav')->render(); ?>
- request->getUri()->getFragment() === 'c-tab-8' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-8' ? ' checked' : ''; ?>>
diff --git a/tests/Models/CategoryMapperTest.php b/tests/Models/CategoryMapperTest.php index 48d9fd4..67b4b2f 100755 --- a/tests/Models/CategoryMapperTest.php +++ b/tests/Models/CategoryMapperTest.php @@ -14,6 +14,7 @@ declare(strict_types=1); namespace Modules\RiskManagement\tests\Models; +use Modules\Admin\Models\NullAccount; use Modules\RiskManagement\Models\Category; use Modules\RiskManagement\Models\CategoryMapper; @@ -29,17 +30,17 @@ class CategoryMapperTest extends \PHPUnit\Framework\TestCase public function testCRUD() : void { $obj = new Category(); - $obj->setTitle('Name'); - $obj->setDescriptionRaw('Description'); - $obj->setResponsible(1); - $obj->setDeputy(1); + $obj->title = 'Name'; + $obj->descriptionRaw = 'Description'; + $obj->responsible = 1; + $obj->deputy = 1; CategoryMapper::create($obj); $objR = CategoryMapper::get($obj->getId()); - self::assertEquals($obj->getTitle(), $objR->getTitle()); - self::assertEquals($obj->getDescriptionRaw(), $objR->getDescriptionRaw()); - self::assertEquals($obj->getResponsible(), $objR->getResponsible()); - self::assertEquals($obj->getDeputy(), $objR->getDeputy()); + self::assertEquals($obj->title, $objR->title); + self::assertEquals($obj->descriptionRaw, $objR->descriptionRaw); + self::assertEquals($obj->responsible, $objR->responsible); + self::assertEquals($obj->deputy, $objR->deputy); } } diff --git a/tests/Models/CategoryTest.php b/tests/Models/CategoryTest.php index 4bad815..2e2aeb2 100755 --- a/tests/Models/CategoryTest.php +++ b/tests/Models/CategoryTest.php @@ -30,12 +30,12 @@ class CategoryTest extends \PHPUnit\Framework\TestCase $obj = new Category(); self::assertEquals(0, $obj->getId()); - self::assertEquals('', $obj->getTitle()); - self::assertEquals('', $obj->getDescription()); - self::assertEquals('', $obj->getDescriptionRaw()); - self::assertNull($obj->getParent()); - self::assertNull($obj->getResponsible()); - self::assertNull($obj->getDeputy()); + self::assertEquals('', $obj->title); + self::assertEquals('', $obj->description); + self::assertEquals('', $obj->descriptionRaw); + self::assertNull($obj->parent); + self::assertNull($obj->responsible); + self::assertNull($obj->deputy); } /** @@ -46,19 +46,19 @@ class CategoryTest extends \PHPUnit\Framework\TestCase { $obj = new Category(); - $obj->setTitle('Name'); - self::assertEquals('Name', $obj->getTitle()); + $obj->title = 'Name'; + self::assertEquals('Name', $obj->title); - $obj->setDescriptionRaw('Description'); - self::assertEquals('Description', $obj->getDescriptionRaw()); + $obj->descriptionRaw = 'Description'; + self::assertEquals('Description', $obj->descriptionRaw); - $obj->setResponsible(1); - self::assertEquals(1, $obj->getResponsible()); + $obj->responsible = 1; + self::assertEquals(1, $obj->responsible); - $obj->setDeputy(1); - self::assertEquals(1, $obj->getDeputy()); + $obj->deputy = 1; + self::assertEquals(1, $obj->deputy); - $obj->setParent(1); - self::assertEquals(1, $obj->getParent()); + $obj->parent = 1; + self::assertEquals(1, $obj->parent); } } diff --git a/tests/Models/CauseMapperTest.php b/tests/Models/CauseMapperTest.php index db87b88..4c60f13 100755 --- a/tests/Models/CauseMapperTest.php +++ b/tests/Models/CauseMapperTest.php @@ -32,8 +32,8 @@ class CauseMapperTest extends \PHPUnit\Framework\TestCase public function testCRUD() : void { $obj = new Cause(); - $obj->setTitle('Cause Test'); - $obj->setDescriptionRaw('Description'); + $obj->title = 'Cause Test'; + $obj->descriptionRaw = 'Description'; $obj->setProbability(1); $department = new Department(); @@ -41,21 +41,21 @@ class CauseMapperTest extends \PHPUnit\Framework\TestCase $obj->setDepartment($department); $category = new Category(); - $category->setTitle('Test Cat'); + $category->title = 'Test Cat'; $obj->setCategory($category); $risk = new Risk(); - $risk->setName('Cause Test Risk'); + $risk->name = 'Cause Test Risk'; $risk->setUnit(1); $obj->setRisk($risk); CauseMapper::create($obj); $objR = CauseMapper::get($obj->getId()); - self::assertEquals($obj->getTitle(), $objR->getTitle()); - self::assertEquals($obj->getDescriptionRaw(), $objR->getDescriptionRaw()); + self::assertEquals($obj->title, $objR->title); + self::assertEquals($obj->descriptionRaw, $objR->descriptionRaw); self::assertEquals($obj->getDepartment()->getDepartment(), $objR->getDepartment()->getDepartment()->getId()); - self::assertEquals($obj->getCategory()->getTitle(), $objR->getCategory()->getTitle()); - self::assertEquals($obj->getRisk()->getName(), $objR->getRisk()->getName()); + self::assertEquals($obj->getCategory()->title, $objR->getCategory()->title); + self::assertEquals($obj->getRisk()->name, $objR->getRisk()->name); } } diff --git a/tests/Models/CauseTest.php b/tests/Models/CauseTest.php index 6cd7ea9..a18d42c 100755 --- a/tests/Models/CauseTest.php +++ b/tests/Models/CauseTest.php @@ -30,9 +30,9 @@ class CauseTest extends \PHPUnit\Framework\TestCase $obj = new Cause(); self::assertEquals(0, $obj->getId()); - self::assertEquals('', $obj->getTitle()); - self::assertEquals('', $obj->getDescription()); - self::assertEquals('', $obj->getDescriptionRaw()); + self::assertEquals('', $obj->title); + self::assertEquals('', $obj->description); + self::assertEquals('', $obj->descriptionRaw); self::assertEquals(0, $obj->getProbability()); self::assertNull($obj->getDepartment()); self::assertNull($obj->getRisk()); @@ -47,11 +47,11 @@ class CauseTest extends \PHPUnit\Framework\TestCase { $obj = new Cause(); - $obj->setTitle('Name'); - self::assertEquals('Name', $obj->getTitle()); + $obj->title = 'Name'; + self::assertEquals('Name', $obj->title); - $obj->setDescriptionRaw('Description'); - self::assertEquals('Description', $obj->getDescriptionRaw()); + $obj->descriptionRaw = 'Description'; + self::assertEquals('Description', $obj->descriptionRaw); $obj->setProbability(1); self::assertEquals(1, $obj->getProbability()); diff --git a/tests/Models/ProcessMapperTest.php b/tests/Models/ProcessMapperTest.php index a5c8712..2de34ff 100755 --- a/tests/Models/ProcessMapperTest.php +++ b/tests/Models/ProcessMapperTest.php @@ -29,8 +29,8 @@ class ProcessMapperTest extends \PHPUnit\Framework\TestCase public function testCRUD() : void { $obj = new Process(); - $obj->setTitle('Name'); - $obj->setDescriptionRaw('Description'); + $obj->title = 'Name'; + $obj->descriptionRaw = 'Description'; $obj->setDepartment(2); $obj->setResponsible(1); $obj->setDeputy(1); @@ -39,8 +39,8 @@ class ProcessMapperTest extends \PHPUnit\Framework\TestCase ProcessMapper::create($obj); $objR = ProcessMapper::get($obj->getId()); - self::assertEquals($obj->getTitle(), $objR->getTitle()); - self::assertEquals($obj->getDescriptionRaw(), $objR->getDescriptionRaw()); + self::assertEquals($obj->title, $objR->title); + self::assertEquals($obj->descriptionRaw, $objR->descriptionRaw); self::assertEquals($obj->getResponsible(), $objR->getResponsible()); self::assertEquals($obj->getDeputy(), $objR->getDeputy()); self::assertEquals($obj->getDepartment(), $objR->getDepartment()->getId()); diff --git a/tests/Models/ProcessTest.php b/tests/Models/ProcessTest.php index 7f8b9bc..eafbcb2 100755 --- a/tests/Models/ProcessTest.php +++ b/tests/Models/ProcessTest.php @@ -30,9 +30,9 @@ class ProcessTest extends \PHPUnit\Framework\TestCase $obj = new Process(); self::assertEquals(0, $obj->getId()); - self::assertEquals('', $obj->getTitle()); - self::assertEquals('', $obj->getDescription()); - self::assertEquals('', $obj->getDescriptionRaw()); + self::assertEquals('', $obj->title); + self::assertEquals('', $obj->description); + self::assertEquals('', $obj->descriptionRaw); self::assertNull($obj->getDepartment()); self::assertEquals(1, $obj->getUnit()); self::assertNull($obj->getResponsible()); @@ -47,11 +47,11 @@ class ProcessTest extends \PHPUnit\Framework\TestCase { $obj = new Process(); - $obj->setTitle('Name'); - self::assertEquals('Name', $obj->getTitle()); + $obj->title = 'Name'; + self::assertEquals('Name', $obj->title); - $obj->setDescriptionRaw('Description'); - self::assertEquals('Description', $obj->getDescriptionRaw()); + $obj->descriptionRaw = 'Description'; + self::assertEquals('Description', $obj->descriptionRaw); $obj->setResponsible(1); self::assertEquals(1, $obj->getResponsible()); diff --git a/tests/Models/RiskMapperTest.php b/tests/Models/RiskMapperTest.php index 32c0438..c3db513 100755 --- a/tests/Models/RiskMapperTest.php +++ b/tests/Models/RiskMapperTest.php @@ -38,8 +38,8 @@ class RiskMapperTest extends \PHPUnit\Framework\TestCase { $obj = new Risk(); - $obj->setName('Risk Test'); - $obj->setDescriptionRaw('Description'); + $obj->name = 'Risk Test'; + $obj->descriptionRaw = 'Description'; $obj->setUnit(1); $obj->setDepartment(2); @@ -57,33 +57,33 @@ class RiskMapperTest extends \PHPUnit\Framework\TestCase $obj->setDeputy(1); $causeObj = new Cause(); - $causeObj->setTitle('Risk Test Cause'); + $causeObj->title = 'Risk Test Cause'; $obj->addCause($causeObj); $solutionObj = new Solution(); - $solutionObj->setTitle('Risk Test Solution'); + $solutionObj->title = 'Risk Test Solution'; $obj->addSolution($solutionObj); $riskObj = new RiskObject(); - $riskObj->setTitle('Risk Test Object'); + $riskObj->title = 'Risk Test Object'; $obj->addRiskObject($riskObj); $obj->addHistory(2); $media = new Media(); - $media->setCreatedBy(new NullAccount(1)); - $media->setDescription('desc'); + $media->createdBy = new NullAccount(1); + $media->description = 'desc'; $media->setPath('some/path'); - $media->setSize(11); - $media->setExtension('png'); - $media->setName('Image'); + $media->size = 11; + $media->extension = 'png'; + $media->name = 'Image'; $obj->addMedia($media); RiskMapper::create($obj); $objR = RiskMapper::get($obj->getId()); - self::assertEquals($obj->getName(), $objR->getName()); - self::assertEquals($obj->getDescriptionRaw(), $objR->getDescriptionRaw()); + self::assertEquals($obj->name, $objR->name); + self::assertEquals($obj->descriptionRaw, $objR->descriptionRaw); self::assertEquals($obj->getUnit(), $objR->getUnit()->getId()); self::assertEquals($obj->getDepartment(), $objR->getDepartment()->getId()); self::assertEquals($obj->getCategory()->getId(), $objR->getCategory()->getId()); @@ -93,13 +93,13 @@ class RiskMapperTest extends \PHPUnit\Framework\TestCase self::assertEquals($obj->getProject()->getProject(), $objR->getProject()->getProject()->getId()); $causes = $objR->getCauses(); - self::assertEquals($obj->getCauses()[0]->getTitle(), \end($causes)->getTitle()); + self::assertEquals($obj->getCauses()[0]->title, \end($causes)->title); $solutions = $objR->getSolutions(); - self::assertEquals($obj->getSolutions()[0]->getTitle(), \end($solutions)->getTitle()); + self::assertEquals($obj->getSolutions()[0]->title, \end($solutions)->title); $riskObjects = $objR->getRiskObjects(); - self::assertEquals($obj->getRiskObjects()[0]->getTitle(), \end($riskObjects)->getTitle()); + self::assertEquals($obj->getRiskObjects()[0]->title, \end($riskObjects)->title); //self::assertEquals($obj->getHistory()[0], $objR->getHistory()[0]); $media = $objR->getMedia(); diff --git a/tests/Models/RiskObjectMapperTest.php b/tests/Models/RiskObjectMapperTest.php index 5b76330..2e7f8ef 100755 --- a/tests/Models/RiskObjectMapperTest.php +++ b/tests/Models/RiskObjectMapperTest.php @@ -29,15 +29,15 @@ class RiskObjectMapperTest extends \PHPUnit\Framework\TestCase public function testCRUD() : void { $obj = new RiskObject(); - $obj->setTitle('Name'); - $obj->setDescriptionRaw('Description'); + $obj->title = 'Name'; + $obj->descriptionRaw = 'Description'; $obj->setRisk(1); RiskObjectMapper::create($obj); $objR = RiskObjectMapper::get($obj->getId()); - self::assertEquals($obj->getTitle(), $objR->getTitle()); - self::assertEquals($obj->getDescriptionRaw(), $objR->getDescriptionRaw()); + self::assertEquals($obj->title, $objR->title); + self::assertEquals($obj->descriptionRaw, $objR->descriptionRaw); self::assertEquals($obj->getRisk(), $objR->getRisk()); } } diff --git a/tests/Models/RiskObjectTest.php b/tests/Models/RiskObjectTest.php index 5ea74c1..afe8482 100755 --- a/tests/Models/RiskObjectTest.php +++ b/tests/Models/RiskObjectTest.php @@ -30,9 +30,9 @@ class RiskObjectTest extends \PHPUnit\Framework\TestCase $obj = new RiskObject(); self::assertEquals(0, $obj->getId()); - self::assertEquals('', $obj->getTitle()); - self::assertEquals('', $obj->getDescription()); - self::assertEquals('', $obj->getDescriptionRaw()); + self::assertEquals('', $obj->title); + self::assertEquals('', $obj->description); + self::assertEquals('', $obj->descriptionRaw); self::assertEquals(0, $obj->getRisk()); } @@ -44,11 +44,11 @@ class RiskObjectTest extends \PHPUnit\Framework\TestCase { $obj = new RiskObject(); - $obj->setTitle('Name'); - self::assertEquals('Name', $obj->getTitle()); + $obj->title = 'Name'; + self::assertEquals('Name', $obj->title); - $obj->setDescriptionRaw('Description'); - self::assertEquals('Description', $obj->getDescriptionRaw()); + $obj->descriptionRaw = 'Description'; + self::assertEquals('Description', $obj->descriptionRaw); $obj->setRisk(1); self::assertEquals(1, $obj->getRisk()); diff --git a/tests/Models/RiskTest.php b/tests/Models/RiskTest.php index 4912dcb..e793f64 100755 --- a/tests/Models/RiskTest.php +++ b/tests/Models/RiskTest.php @@ -33,9 +33,9 @@ class RiskTest extends \PHPUnit\Framework\TestCase $obj = new Risk(); self::assertEquals(0, $obj->getId()); - self::assertEquals('', $obj->getName()); - self::assertEquals('', $obj->getDescription()); - self::assertEquals('', $obj->getDescriptionRaw()); + self::assertEquals('', $obj->name); + self::assertEquals('', $obj->description); + self::assertEquals('', $obj->descriptionRaw); self::assertEquals(1, $obj->getUnit()); self::assertNull($obj->getDepartment()); self::assertNull($obj->getCategory()); @@ -58,11 +58,11 @@ class RiskTest extends \PHPUnit\Framework\TestCase { $obj = new Risk(); - $obj->setName('Name'); - self::assertEquals('Name', $obj->getName()); + $obj->name = 'Name'; + self::assertEquals('Name', $obj->name); - $obj->setDescriptionRaw('Description'); - self::assertEquals('Description', $obj->getDescriptionRaw()); + $obj->descriptionRaw = 'Description'; + self::assertEquals('Description', $obj->descriptionRaw); $obj->setUnit(1); self::assertEquals(1, $obj->getUnit()); diff --git a/tests/Models/SolutionMapperTest.php b/tests/Models/SolutionMapperTest.php index 623b553..dd7f930 100755 --- a/tests/Models/SolutionMapperTest.php +++ b/tests/Models/SolutionMapperTest.php @@ -30,8 +30,8 @@ class SolutionMapperTest extends \PHPUnit\Framework\TestCase { $obj = new Solution(); - $obj->setTitle('Title'); - $obj->setDescriptionRaw('Description'); + $obj->title = 'Title'; + $obj->descriptionRaw = 'Description'; $obj->setProbability(1); $obj->setCause(1); $obj->setRisk(1); @@ -39,8 +39,8 @@ class SolutionMapperTest extends \PHPUnit\Framework\TestCase SolutionMapper::create($obj); $objR = SolutionMapper::get($obj->getId()); - self::assertEquals($obj->getTitle(), $objR->getTitle()); - self::assertEquals($obj->getDescriptionRaw(), $objR->getDescriptionRaw()); + self::assertEquals($obj->title, $objR->title); + self::assertEquals($obj->descriptionRaw, $objR->descriptionRaw); self::assertEquals($obj->getProbability(), $objR->getProbability()); self::assertEquals($obj->getRisk(), $objR->getRisk()->getId()); self::assertEquals($obj->getCause(), $objR->getCause()->getId()); diff --git a/tests/Models/SolutionTest.php b/tests/Models/SolutionTest.php index 9bfdc27..20662c5 100755 --- a/tests/Models/SolutionTest.php +++ b/tests/Models/SolutionTest.php @@ -30,9 +30,9 @@ class SolutionTest extends \PHPUnit\Framework\TestCase $obj = new Solution(); self::assertEquals(0, $obj->getId()); - self::assertEquals('', $obj->getTitle()); - self::assertEquals('', $obj->getDescription()); - self::assertEquals('', $obj->getDescriptionRaw()); + self::assertEquals('', $obj->title); + self::assertEquals('', $obj->description); + self::assertEquals('', $obj->descriptionRaw); self::assertEquals(0, $obj->getProbability()); self::assertEquals(0, $obj->getCause()); self::assertEquals(0, $obj->getRisk()); @@ -46,11 +46,11 @@ class SolutionTest extends \PHPUnit\Framework\TestCase { $obj = new Solution(); - $obj->setTitle('Title'); - self::assertEquals('Title', $obj->getTitle()); + $obj->title = 'Title'; + self::assertEquals('Title', $obj->title); - $obj->setDescriptionRaw('Description'); - self::assertEquals('Description', $obj->getDescriptionRaw()); + $obj->descriptionRaw = 'Description'; + self::assertEquals('Description', $obj->descriptionRaw); $obj->setProbability(1); self::assertEquals(1, $obj->getProbability());