mirror of
https://github.com/Karaka-Management/oms-RiskManagement.git
synced 2026-01-11 19:38:40 +00:00
cs fixes, bug fixes, code coverage
This commit is contained in:
parent
7c8d916102
commit
a346158b63
|
|
@ -12,9 +12,7 @@ If you have a good idea for improvement feel free to create a new issue with all
|
|||
|
||||
### Issues
|
||||
|
||||
Feel free to grab any open issue implement it and create a new pull request. Most issues can be found in the `Project.md` file in the `Docs` repository.
|
||||
|
||||
The issue information can be used to provide additional information such as priority, difficulty and type. For your first issue try to find a issue marked `[d:first]` or `[d:beginner]`.
|
||||
Feel free to grab any open issue implement it and create a new pull request. Most issues can be found in the code marked with `@todo` or in the [PROJECT.md](https://github.com/Orange-Management/Docs/blob/master/Project/PROJECT.md) file.
|
||||
|
||||
### Code Style
|
||||
|
||||
|
|
|
|||
112
Models/Cause.php
112
Models/Cause.php
|
|
@ -50,13 +50,13 @@ class Cause
|
|||
*/
|
||||
public string $descriptionRaw = '';
|
||||
|
||||
private int $probability = 0;
|
||||
public int $probability = 0;
|
||||
|
||||
private ?Department $department = null;
|
||||
public ?Department $department = null;
|
||||
|
||||
private ?Risk $risk = null;
|
||||
public ?Risk $risk = null;
|
||||
|
||||
private ?Category $category = null;
|
||||
public ?Category $category = null;
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
|
|
@ -69,108 +69,4 @@ class Cause
|
|||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set risk.
|
||||
*
|
||||
* @param mixed $risk Risk
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setRisk($risk) : void
|
||||
{
|
||||
$this->risk = $risk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get risk.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getRisk()
|
||||
{
|
||||
return $this->risk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get category.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
return $this->category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set category.
|
||||
*
|
||||
* @param mixed $category Category
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setCategory($category) : void
|
||||
{
|
||||
$this->category = $category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get probability.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getProbability() : int
|
||||
{
|
||||
return $this->probability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set probability.
|
||||
*
|
||||
* @param int $probability Probability
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setProbability(int $probability) : void
|
||||
{
|
||||
$this->probability = $probability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get department.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDepartment()
|
||||
{
|
||||
return $this->department;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set department.
|
||||
*
|
||||
* @param mixed $department Department
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDepartment($department) : void
|
||||
{
|
||||
$this->department = $department;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ class Department
|
|||
|
||||
public ?OrgDepartment $department = null;
|
||||
|
||||
private ?int $responsible = null;
|
||||
public ?int $responsible = null;
|
||||
|
||||
private ?int $deputy = null;
|
||||
public ?int $deputy = null;
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
|
|
@ -51,56 +51,4 @@ class Department
|
|||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get deputy.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDeputy()
|
||||
{
|
||||
return $this->deputy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set deputy.
|
||||
*
|
||||
* @param mixed $deputy Deputy
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDeputy($deputy) : void
|
||||
{
|
||||
$this->deputy = $deputy;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,13 +52,13 @@ class Process
|
|||
*/
|
||||
public string $descriptionRaw = '';
|
||||
|
||||
private ?Department $department = null;
|
||||
public ?Department $department = null;
|
||||
|
||||
private ?int $responsible = null;
|
||||
public ?int $responsible = null;
|
||||
|
||||
private ?int $deputy = null;
|
||||
public ?int $deputy = null;
|
||||
|
||||
private ?Unit $unit = null;
|
||||
public ?Unit $unit = null;
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
|
|
@ -71,108 +71,4 @@ class Process
|
|||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get unit.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getUnit()
|
||||
{
|
||||
return $this->unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set unit.
|
||||
*
|
||||
* @param mixed $unit Unit
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setUnit($unit) : void
|
||||
{
|
||||
$this->unit = $unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get department.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDepartment()
|
||||
{
|
||||
return $this->department;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set department.
|
||||
*
|
||||
* @param mixed $department Department
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDepartment($department) : void
|
||||
{
|
||||
$this->department = $department;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get deputy.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDeputy()
|
||||
{
|
||||
return $this->deputy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set deputy.
|
||||
*
|
||||
* @param mixed $deputy Deputy
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDeputy($deputy) : void
|
||||
{
|
||||
$this->deputy = $deputy;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ class Project
|
|||
*/
|
||||
protected int $id = 0;
|
||||
|
||||
private ?PMProject $project = null;
|
||||
public ?PMProject $project = null;
|
||||
|
||||
private ?int $responsible = null;
|
||||
public ?int $responsible = null;
|
||||
|
||||
private ?int $deputy = null;
|
||||
public ?int $deputy = null;
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
|
|
@ -51,82 +51,4 @@ class Project
|
|||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getProject()
|
||||
{
|
||||
return $this->project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set project.
|
||||
*
|
||||
* @param mixed $project Project
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setProject($project) : void
|
||||
{
|
||||
$this->project = $project;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get deputy.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDeputy()
|
||||
{
|
||||
return $this->deputy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set deputy.
|
||||
*
|
||||
* @param mixed $deputy Deputy
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDeputy($deputy) : void
|
||||
{
|
||||
$this->deputy = $deputy;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
198
Models/Risk.php
198
Models/Risk.php
|
|
@ -59,19 +59,19 @@ class Risk
|
|||
*/
|
||||
public string $descriptionRaw = '';
|
||||
|
||||
private ?Unit $unit = null;
|
||||
public ?Unit $unit = null;
|
||||
|
||||
private ?Department $department = null;
|
||||
public ?Department $department = null;
|
||||
|
||||
private ?Category $category = null;
|
||||
public ?Category $category = null;
|
||||
|
||||
private ?Project $project = null;
|
||||
public ?Project $project = null;
|
||||
|
||||
private ?Process $process = null;
|
||||
public ?Process $process = null;
|
||||
|
||||
private ?int $responsible = null;
|
||||
public ?int $responsible = null;
|
||||
|
||||
private ?int $deputy = null;
|
||||
public ?int $deputy = null;
|
||||
|
||||
private array $histScore = [];
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ class Risk
|
|||
|
||||
private array $media = [];
|
||||
|
||||
private \DateTimeImmutable $createdAt;
|
||||
public \DateTimeImmutable $createdAt;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
@ -236,186 +236,4 @@ class Risk
|
|||
{
|
||||
return $this->histScore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get unit.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getUnit()
|
||||
{
|
||||
return $this->unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set unit.
|
||||
*
|
||||
* @param mixed $unit Unit
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setUnit($unit) : void
|
||||
{
|
||||
$this->unit = $unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get department.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDepartment()
|
||||
{
|
||||
return $this->department;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set department.
|
||||
*
|
||||
* @param mixed $department Department
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDepartment($department) : void
|
||||
{
|
||||
$this->department = $department;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get category.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
return $this->category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set category.
|
||||
*
|
||||
* @param mixed $category Category
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setCategory($category) : void
|
||||
{
|
||||
$this->category = $category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getProject()
|
||||
{
|
||||
return $this->project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set project.
|
||||
*
|
||||
* @param mixed $project Project
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setProject($project) : void
|
||||
{
|
||||
$this->project = $project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get process.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getProcess()
|
||||
{
|
||||
return $this->process;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set process.
|
||||
*
|
||||
* @param mixed $process Process
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setProcess($process) : void
|
||||
{
|
||||
$this->process = $process;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get deputy.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDeputy()
|
||||
{
|
||||
return $this->deputy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set deputy.
|
||||
*
|
||||
* @param mixed $deputy Deputy
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDeputy($deputy) : void
|
||||
{
|
||||
$this->deputy = $deputy;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class RiskObject
|
|||
*/
|
||||
public string $descriptionRaw = '';
|
||||
|
||||
private ?int $risk = null;
|
||||
public ?int $risk = null;
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
|
|
@ -63,30 +63,4 @@ class RiskObject
|
|||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get risk.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getRisk()
|
||||
{
|
||||
return $this->risk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set risk.
|
||||
*
|
||||
* @param mixed $risk Risk
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setRisk($risk) : void
|
||||
{
|
||||
$this->risk = $risk;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,11 +50,11 @@ class Solution
|
|||
*/
|
||||
public string $descriptionRaw = '';
|
||||
|
||||
private int $probability = 0;
|
||||
public int $probability = 0;
|
||||
|
||||
private ?Cause $cause = null;
|
||||
public ?Cause $cause = null;
|
||||
|
||||
private ?Risk $risk = null;
|
||||
public ?Risk $risk = null;
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
|
|
@ -67,120 +67,4 @@ class Solution
|
|||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set risk.
|
||||
*
|
||||
* @param mixed $risk Risk
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setRisk($risk) : void
|
||||
{
|
||||
$this->risk = $risk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get risk.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getRisk()
|
||||
{
|
||||
return $this->risk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cause.
|
||||
*
|
||||
* @param mixed $cause Cause
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setCause($cause) : void
|
||||
{
|
||||
$this->cause = $cause;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cause.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCause()
|
||||
{
|
||||
return $this->cause;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get probability.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getProbability() : int
|
||||
{
|
||||
return $this->probability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set probability.
|
||||
*
|
||||
* @param int $probability Probability
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setProbability(int $probability) : void
|
||||
{
|
||||
$this->probability = $probability;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,28 +37,4 @@ final class CategoryTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertNull($obj->responsible);
|
||||
self::assertNull($obj->deputy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\Category
|
||||
* @group module
|
||||
*/
|
||||
public function testSetGet() : void
|
||||
{
|
||||
$obj = new Category();
|
||||
|
||||
$obj->title = 'Name';
|
||||
self::assertEquals('Name', $obj->title);
|
||||
|
||||
$obj->descriptionRaw = 'Description';
|
||||
self::assertEquals('Description', $obj->descriptionRaw);
|
||||
|
||||
$obj->responsible = 1;
|
||||
self::assertEquals(1, $obj->responsible);
|
||||
|
||||
$obj->deputy = 1;
|
||||
self::assertEquals(1, $obj->deputy);
|
||||
|
||||
$obj->parent = 1;
|
||||
self::assertEquals(1, $obj->parent);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,20 +36,20 @@ final class CauseMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$obj = new Cause();
|
||||
$obj->title = 'Cause Test';
|
||||
$obj->descriptionRaw = 'Description';
|
||||
$obj->setProbability(1);
|
||||
$obj->probability = 1;
|
||||
|
||||
$department = new Department();
|
||||
$department->department = new NullOrgDepartment(1);
|
||||
$obj->setDepartment($department);
|
||||
$obj->department = $department;
|
||||
|
||||
$category = new Category();
|
||||
$category->title = 'Test Cat';
|
||||
$obj->setCategory($category);
|
||||
$obj->category = $category;
|
||||
|
||||
$risk = new Risk();
|
||||
$risk->name = 'Cause Test Risk';
|
||||
$risk->setUnit(new NullUnit(1));
|
||||
$obj->setRisk($risk);
|
||||
$risk->unit = new NullUnit(1);
|
||||
$obj->risk = $risk;
|
||||
|
||||
CauseMapper::create($obj);
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ final class CauseMapperTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($obj->title, $objR->title);
|
||||
self::assertEquals($obj->descriptionRaw, $objR->descriptionRaw);
|
||||
//self::assertEquals($obj->getDepartment()->department->getId(), $objR->getDepartment()->department->getId());
|
||||
self::assertEquals($obj->getCategory()->title, $objR->getCategory()->title);
|
||||
self::assertEquals($obj->getRisk()->name, $objR->getRisk()->name);
|
||||
self::assertEquals($obj->category->title, $objR->category->title);
|
||||
self::assertEquals($obj->risk->name, $objR->risk->name);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@ declare(strict_types=1);
|
|||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\Cause;
|
||||
use Modules\RiskManagement\Models\NullCategory;
|
||||
use Modules\RiskManagement\Models\NullDepartment;
|
||||
use Modules\RiskManagement\Models\NullRisk;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -36,36 +33,9 @@ final class CauseTest extends \PHPUnit\Framework\TestCase
|
|||
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());
|
||||
self::assertNull($obj->getCategory());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\Cause
|
||||
* @group module
|
||||
*/
|
||||
public function testSetGet() : void
|
||||
{
|
||||
$obj = new Cause();
|
||||
|
||||
$obj->title = 'Name';
|
||||
self::assertEquals('Name', $obj->title);
|
||||
|
||||
$obj->descriptionRaw = 'Description';
|
||||
self::assertEquals('Description', $obj->descriptionRaw);
|
||||
|
||||
$obj->setProbability(1);
|
||||
self::assertEquals(1, $obj->getProbability());
|
||||
|
||||
$obj->setCategory(new NullCategory(2));
|
||||
self::assertEquals(2, $obj->getCategory()->getId());
|
||||
|
||||
$obj->setRisk(new NullRisk(1));
|
||||
self::assertEquals(1, $obj->getRisk()->getId());
|
||||
|
||||
$obj->setDepartment(new NullDepartment(1));
|
||||
self::assertEquals(1, $obj->getDepartment()->getId());
|
||||
self::assertEquals(0, $obj->probability);
|
||||
self::assertNull($obj->department);
|
||||
self::assertNull($obj->risk);
|
||||
self::assertNull($obj->category);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,16 +29,16 @@ final class DepartmentMapperTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testCRUD() : void
|
||||
{
|
||||
$obj = new Department();
|
||||
$obj->department = new NullDepartment();
|
||||
$obj->setResponsible(1);
|
||||
$obj->setDeputy(1);
|
||||
$obj = new Department();
|
||||
$obj->department = new NullDepartment();
|
||||
$obj->responsible = 1;
|
||||
$obj->deputy = 1;
|
||||
|
||||
DepartmentMapper::create($obj);
|
||||
|
||||
$objR = DepartmentMapper::get($obj->getId());
|
||||
self::assertEquals($obj->department->getId(), $objR->department->getId());
|
||||
self::assertEquals($obj->getResponsible(), $objR->getResponsible());
|
||||
self::assertEquals($obj->getDeputy(), $objR->getDeputy());
|
||||
self::assertEquals($obj->responsible, $objR->responsible);
|
||||
self::assertEquals($obj->deputy, $objR->deputy);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\Organization\Models\NullDepartment as NullOrgDepartment;
|
||||
use Modules\RiskManagement\Models\Department;
|
||||
|
||||
/**
|
||||
|
|
@ -32,25 +31,7 @@ final class DepartmentTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
self::assertEquals(0, $obj->getId());
|
||||
self::assertNull($obj->department);
|
||||
self::assertNull($obj->getResponsible());
|
||||
self::assertNull($obj->getDeputy());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\Department
|
||||
* @group module
|
||||
*/
|
||||
public function testSetGet() : void
|
||||
{
|
||||
$obj = new Department();
|
||||
|
||||
$obj->department = new NullOrgDepartment(1);
|
||||
self::assertEquals(1, $obj->department->getId());
|
||||
|
||||
$obj->setResponsible(1);
|
||||
self::assertEquals(1, $obj->getResponsible());
|
||||
|
||||
$obj->setDeputy(3);
|
||||
self::assertEquals(3, $obj->getDeputy());
|
||||
self::assertNull($obj->responsible);
|
||||
self::assertNull($obj->deputy);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
42
tests/Models/NullCategoryTest.php
Normal file
42
tests/Models/NullCategoryTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\NullCategory;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullCategoryTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullCategory
|
||||
* @group framework
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\RiskManagement\Models\Category', new NullCategory());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullCategory
|
||||
* @group framework
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullCategory(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
42
tests/Models/NullCauseTest.php
Normal file
42
tests/Models/NullCauseTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\NullCause;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullCauseTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullCause
|
||||
* @group framework
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\RiskManagement\Models\Cause', new NullCause());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullCause
|
||||
* @group framework
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullCause(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
42
tests/Models/NullDepartmentTest.php
Normal file
42
tests/Models/NullDepartmentTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\NullDepartment;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullDepartmentTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullDepartment
|
||||
* @group framework
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\RiskManagement\Models\Department', new NullDepartment());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullDepartment
|
||||
* @group framework
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullDepartment(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
42
tests/Models/NullProcessTest.php
Normal file
42
tests/Models/NullProcessTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\NullProcess;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullProcessTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullProcess
|
||||
* @group framework
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\RiskManagement\Models\Process', new NullProcess());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullProcess
|
||||
* @group framework
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullProcess(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
42
tests/Models/NullProjectTest.php
Normal file
42
tests/Models/NullProjectTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\NullProject;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullProjectTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullProject
|
||||
* @group framework
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\RiskManagement\Models\Project', new NullProject());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullProject
|
||||
* @group framework
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullProject(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
42
tests/Models/NullRiskObjectTest.php
Normal file
42
tests/Models/NullRiskObjectTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\NullRiskObject;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullRiskObjectTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullRiskObject
|
||||
* @group framework
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\RiskManagement\Models\RiskObject', new NullRiskObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullRiskObject
|
||||
* @group framework
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullRiskObject(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
42
tests/Models/NullRiskTest.php
Normal file
42
tests/Models/NullRiskTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\NullRisk;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullRiskTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullRisk
|
||||
* @group framework
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\RiskManagement\Models\Risk', new NullRisk());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullRisk
|
||||
* @group framework
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullRisk(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
42
tests/Models/NullSolutionTest.php
Normal file
42
tests/Models/NullSolutionTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\NullSolution;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullSolutionTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullSolution
|
||||
* @group framework
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\RiskManagement\Models\Solution', new NullSolution());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\NullSolution
|
||||
* @group framework
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullSolution(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
|
|
@ -33,19 +33,19 @@ final class ProcessMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$obj = new Process();
|
||||
$obj->title = 'Name';
|
||||
$obj->descriptionRaw = 'Description';
|
||||
$obj->setDepartment(new NullDepartment(1));
|
||||
$obj->setResponsible(1);
|
||||
$obj->setDeputy(1);
|
||||
$obj->setUnit(new NullUnit(1));
|
||||
$obj->department = new NullDepartment(1);
|
||||
$obj->responsible = 1;
|
||||
$obj->deputy = 1;
|
||||
$obj->unit = new NullUnit(1);
|
||||
|
||||
ProcessMapper::create($obj);
|
||||
|
||||
$objR = ProcessMapper::get($obj->getId());
|
||||
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()->getId(), $objR->getDepartment()->getId());
|
||||
self::assertEquals($obj->getUnit()->getId(), $objR->getUnit()->getId());
|
||||
self::assertEquals($obj->responsible, $objR->responsible);
|
||||
self::assertEquals($obj->deputy, $objR->deputy);
|
||||
self::assertEquals($obj->department->getId(), $objR->department->getId());
|
||||
self::assertEquals($obj->unit->getId(), $objR->unit->getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\Organization\Models\NullUnit;
|
||||
use Modules\RiskManagement\Models\NullDepartment;
|
||||
use Modules\RiskManagement\Models\Process;
|
||||
|
||||
/**
|
||||
|
|
@ -35,36 +33,9 @@ final class ProcessTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('', $obj->title);
|
||||
self::assertEquals('', $obj->description);
|
||||
self::assertEquals('', $obj->descriptionRaw);
|
||||
self::assertNull($obj->getDepartment());
|
||||
self::assertNull($obj->getUnit());
|
||||
self::assertNull($obj->getResponsible());
|
||||
self::assertNull($obj->getDeputy());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\Process
|
||||
* @group module
|
||||
*/
|
||||
public function testSetGet() : void
|
||||
{
|
||||
$obj = new Process();
|
||||
|
||||
$obj->title = 'Name';
|
||||
self::assertEquals('Name', $obj->title);
|
||||
|
||||
$obj->descriptionRaw = 'Description';
|
||||
self::assertEquals('Description', $obj->descriptionRaw);
|
||||
|
||||
$obj->setResponsible(1);
|
||||
self::assertEquals(1, $obj->getResponsible());
|
||||
|
||||
$obj->setDeputy(1);
|
||||
self::assertEquals(1, $obj->getDeputy());
|
||||
|
||||
$obj->setUnit(new NullUnit(1));
|
||||
self::assertEquals(1, $obj->getUnit()->getId());
|
||||
|
||||
$obj->setDepartment(new NullDepartment(2));
|
||||
self::assertEquals(2, $obj->getDepartment()->getId());
|
||||
self::assertNull($obj->department);
|
||||
self::assertNull($obj->unit);
|
||||
self::assertNull($obj->responsible);
|
||||
self::assertNull($obj->deputy);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,16 +29,16 @@ final class ProjectMapperTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testCRUD() : void
|
||||
{
|
||||
$obj = new Project();
|
||||
$obj->setProject(new NullProject(1));
|
||||
$obj->setResponsible(1);
|
||||
$obj->setDeputy(1);
|
||||
$obj = new Project();
|
||||
$obj->project = new NullProject(1);
|
||||
$obj->responsible = 1;
|
||||
$obj->deputy = 1;
|
||||
|
||||
ProjectMapper::create($obj);
|
||||
|
||||
$objR = ProjectMapper::get($obj->getId());
|
||||
self::assertEquals($obj->getProject()->getId(), $objR->getProject()->getId());
|
||||
self::assertEquals($obj->getResponsible(), $objR->getResponsible());
|
||||
self::assertEquals($obj->getDeputy(), $objR->getDeputy());
|
||||
self::assertEquals($obj->project->getId(), $objR->project->getId());
|
||||
self::assertEquals($obj->responsible, $objR->responsible);
|
||||
self::assertEquals($obj->deputy, $objR->deputy);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\ProjectManagement\Models\NullProject;
|
||||
use Modules\RiskManagement\Models\Project;
|
||||
|
||||
/**
|
||||
|
|
@ -31,26 +30,8 @@ final class ProjectTest extends \PHPUnit\Framework\TestCase
|
|||
$obj = new Project();
|
||||
|
||||
self::assertEquals(0, $obj->getId());
|
||||
self::assertNull($obj->getProject());
|
||||
self::assertNull($obj->getResponsible());
|
||||
self::assertNull($obj->getDeputy());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\Project
|
||||
* @group module
|
||||
*/
|
||||
public function testSetGet() : void
|
||||
{
|
||||
$obj = new Project();
|
||||
|
||||
$obj->setResponsible(1);
|
||||
self::assertEquals(1, $obj->getResponsible());
|
||||
|
||||
$obj->setDeputy(1);
|
||||
self::assertEquals(1, $obj->getDeputy());
|
||||
|
||||
$obj->setProject(new NullProject(1));
|
||||
self::assertEquals(1, $obj->getProject()->getId());
|
||||
self::assertNull($obj->project);
|
||||
self::assertNull($obj->responsible);
|
||||
self::assertNull($obj->deputy);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,21 +43,21 @@ final class RiskMapperTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$obj->name = 'Risk Test';
|
||||
$obj->descriptionRaw = 'Description';
|
||||
$obj->setUnit(new NullUnit(1));
|
||||
$obj->setDepartment(new NullDepartment(1));
|
||||
$obj->unit = new NullUnit(1);
|
||||
$obj->department = new NullDepartment(1);
|
||||
|
||||
$categoryObj = new Category();
|
||||
$obj->setCategory($categoryObj);
|
||||
$categoryObj = new Category();
|
||||
$obj->category = $categoryObj;
|
||||
|
||||
$processObj = new Process();
|
||||
$obj->setProcess($processObj);
|
||||
$processObj = new Process();
|
||||
$obj->process = $processObj;
|
||||
|
||||
$projectObj = new Project();
|
||||
$projectObj->setProject(new NullProject(1));
|
||||
$obj->setProject($projectObj);
|
||||
$projectObj = new Project();
|
||||
$projectObj->project = new NullProject(1);
|
||||
$obj->project = $projectObj;
|
||||
|
||||
$obj->setResponsible(1);
|
||||
$obj->setDeputy(1);
|
||||
$obj->responsible = 1;
|
||||
$obj->deputy = 1;
|
||||
|
||||
$causeObj = new Cause();
|
||||
$causeObj->title = 'Risk Test Cause';
|
||||
|
|
@ -87,13 +87,13 @@ final class RiskMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$objR = RiskMapper::get($obj->getId());
|
||||
self::assertEquals($obj->name, $objR->name);
|
||||
self::assertEquals($obj->descriptionRaw, $objR->descriptionRaw);
|
||||
self::assertEquals($obj->getUnit()->getId(), $objR->getUnit()->getId());
|
||||
self::assertEquals($obj->getDepartment()->getId(), $objR->getDepartment()->getId());
|
||||
self::assertEquals($obj->getCategory()->getId(), $objR->getCategory()->getId());
|
||||
self::assertEquals($obj->getProcess()->getId(), $objR->getProcess()->getId());
|
||||
self::assertEquals($obj->getResponsible(), $objR->getResponsible());
|
||||
self::assertEquals($obj->getDeputy(), $objR->getDeputy());
|
||||
self::assertEquals($obj->getProject()->getProject()->getId(), $objR->getProject()->getProject()->getId());
|
||||
self::assertEquals($obj->unit->getId(), $objR->unit->getId());
|
||||
self::assertEquals($obj->department->getId(), $objR->department->getId());
|
||||
self::assertEquals($obj->category->getId(), $objR->category->getId());
|
||||
self::assertEquals($obj->process->getId(), $objR->process->getId());
|
||||
self::assertEquals($obj->responsible, $objR->responsible);
|
||||
self::assertEquals($obj->deputy, $objR->deputy);
|
||||
self::assertEquals($obj->project->project->getId(), $objR->project->project->getId());
|
||||
|
||||
$causes = $objR->getCauses();
|
||||
self::assertEquals($obj->getCauses()[0]->title, \end($causes)->title);
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@ final class RiskObjectMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$obj = new RiskObject();
|
||||
$obj->title = 'Name';
|
||||
$obj->descriptionRaw = 'Description';
|
||||
$obj->setRisk(1);
|
||||
$obj->risk = 1;
|
||||
|
||||
RiskObjectMapper::create($obj);
|
||||
|
||||
$objR = RiskObjectMapper::get($obj->getId());
|
||||
self::assertEquals($obj->title, $objR->title);
|
||||
self::assertEquals($obj->descriptionRaw, $objR->descriptionRaw);
|
||||
self::assertEquals($obj->getRisk(), $objR->getRisk());
|
||||
self::assertEquals($obj->risk, $objR->risk);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,24 +33,6 @@ final class RiskObjectTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('', $obj->title);
|
||||
self::assertEquals('', $obj->description);
|
||||
self::assertEquals('', $obj->descriptionRaw);
|
||||
self::assertEquals(0, $obj->getRisk());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\RiskObject
|
||||
* @group module
|
||||
*/
|
||||
public function testSetGet() : void
|
||||
{
|
||||
$obj = new RiskObject();
|
||||
|
||||
$obj->title = 'Name';
|
||||
self::assertEquals('Name', $obj->title);
|
||||
|
||||
$obj->descriptionRaw = 'Description';
|
||||
self::assertEquals('Description', $obj->descriptionRaw);
|
||||
|
||||
$obj->setRisk(1);
|
||||
self::assertEquals(1, $obj->getRisk());
|
||||
self::assertEquals(0, $obj->risk);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,12 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\Organization\Models\NullDepartment;
|
||||
use Modules\Organization\Models\NullUnit;
|
||||
use Modules\RiskManagement\Models\Cause;
|
||||
use Modules\RiskManagement\Models\Department;
|
||||
use Modules\RiskManagement\Models\NullCategory;
|
||||
use Modules\RiskManagement\Models\NullProcess;
|
||||
use Modules\RiskManagement\Models\Risk;
|
||||
use Modules\RiskManagement\Models\Solution;
|
||||
|
||||
|
|
@ -28,80 +23,89 @@ use Modules\RiskManagement\Models\Solution;
|
|||
*/
|
||||
final class RiskTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
private Risk $risk;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() : void
|
||||
{
|
||||
$this->risk = new Risk();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\Risk
|
||||
* @group module
|
||||
*/
|
||||
public function testDefault() : void
|
||||
{
|
||||
$obj = new Risk();
|
||||
|
||||
self::assertEquals(0, $obj->getId());
|
||||
self::assertEquals('', $obj->name);
|
||||
self::assertEquals('', $obj->description);
|
||||
self::assertEquals('', $obj->descriptionRaw);
|
||||
self::assertNull($obj->getUnit());
|
||||
self::assertNull($obj->getDepartment());
|
||||
self::assertNull($obj->getCategory());
|
||||
self::assertNull($obj->getProcess());
|
||||
self::assertNull($obj->getProject());
|
||||
self::assertNull($obj->getResponsible());
|
||||
self::assertNull($obj->getDeputy());
|
||||
self::assertEquals([], $obj->getHistory());
|
||||
self::assertEquals([], $obj->getCauses());
|
||||
self::assertEquals([], $obj->getSolutions());
|
||||
self::assertEquals([], $obj->getRiskObjects());
|
||||
self::assertEquals([], $obj->getMedia());
|
||||
self::assertEquals(0, $this->risk->getId());
|
||||
self::assertEquals('', $this->risk->name);
|
||||
self::assertEquals('', $this->risk->description);
|
||||
self::assertEquals('', $this->risk->descriptionRaw);
|
||||
self::assertNull($this->risk->unit);
|
||||
self::assertNull($this->risk->department);
|
||||
self::assertNull($this->risk->category);
|
||||
self::assertNull($this->risk->process);
|
||||
self::assertNull($this->risk->project);
|
||||
self::assertNull($this->risk->responsible);
|
||||
self::assertNull($this->risk->deputy);
|
||||
self::assertEquals([], $this->risk->getHistory());
|
||||
self::assertEquals([], $this->risk->getCauses());
|
||||
self::assertEquals([], $this->risk->getSolutions());
|
||||
self::assertEquals([], $this->risk->getRiskObjects());
|
||||
self::assertEquals([], $this->risk->getMedia());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\Risk
|
||||
* @group module
|
||||
*/
|
||||
public function testSetGet() : void
|
||||
public function testCauseInputOutput() : void
|
||||
{
|
||||
$obj = new Risk();
|
||||
$this->risk->addCause(new Cause());
|
||||
self::assertCount(1, $this->risk->getCauses());
|
||||
self::assertInstanceOf('\Modules\RiskManagement\Models\Cause', $this->risk->getCauses()[0]);
|
||||
}
|
||||
|
||||
$obj->name = 'Name';
|
||||
self::assertEquals('Name', $obj->name);
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\Risk
|
||||
* @group module
|
||||
*/
|
||||
public function testSolutionInputOutput() : void
|
||||
{
|
||||
$this->risk->addSolution(new Solution());
|
||||
self::assertCount(1, $this->risk->getSolutions());
|
||||
self::assertInstanceOf('\Modules\RiskManagement\Models\Solution', $this->risk->getSolutions()[0]);
|
||||
}
|
||||
|
||||
$obj->descriptionRaw = 'Description';
|
||||
self::assertEquals('Description', $obj->descriptionRaw);
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\Risk
|
||||
* @group module
|
||||
*/
|
||||
public function testRiskObjectInputOutput() : void
|
||||
{
|
||||
$this->risk->addRiskObject(2);
|
||||
self::assertCount(1, $this->risk->getRiskObjects());
|
||||
}
|
||||
|
||||
$obj->setUnit(new NullUnit(1));
|
||||
self::assertEquals(1, $obj->getUnit()->getId());
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\Risk
|
||||
* @group module
|
||||
*/
|
||||
public function testHistoryInputOutput() : void
|
||||
{
|
||||
$this->risk->addHistory(2);
|
||||
self::assertCount(1, $this->risk->getHistory());
|
||||
}
|
||||
|
||||
$obj->setCategory(new NullCategory(3));
|
||||
self::assertEquals(3, $obj->getCategory()->getId());
|
||||
|
||||
$obj->setProcess(new NullProcess(4));
|
||||
self::assertEquals(4, $obj->getProcess()->getId());
|
||||
|
||||
$department = new Department();
|
||||
$department->department = new NullDepartment(1);
|
||||
$obj->setDepartment(new NullDepartment(1));
|
||||
|
||||
$obj->setResponsible(1);
|
||||
self::assertEquals(1, $obj->getResponsible());
|
||||
|
||||
$obj->setDeputy(1);
|
||||
self::assertEquals(1, $obj->getDeputy());
|
||||
|
||||
$obj->addCause(new Cause());
|
||||
self::assertCount(1, $obj->getCauses());
|
||||
self::assertInstanceOf('\Modules\RiskManagement\Models\Cause', $obj->getCauses()[0]);
|
||||
|
||||
$obj->addSolution(new Solution());
|
||||
self::assertCount(1, $obj->getSolutions());
|
||||
self::assertInstanceOf('\Modules\RiskManagement\Models\Solution', $obj->getSolutions()[0]);
|
||||
|
||||
$obj->addRiskObject(2);
|
||||
self::assertCount(1, $obj->getRiskObjects());
|
||||
|
||||
$obj->addHistory(2);
|
||||
self::assertCount(1, $obj->getHistory());
|
||||
|
||||
$obj->addMedia(2);
|
||||
self::assertCount(1, $obj->getMedia());
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\Risk
|
||||
* @group module
|
||||
*/
|
||||
public function testMediaInputOutput() : void
|
||||
{
|
||||
$this->risk->addMedia(2);
|
||||
self::assertCount(1, $this->risk->getMedia());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,17 +34,17 @@ final class SolutionMapperTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$obj->title = 'Title';
|
||||
$obj->descriptionRaw = 'Description';
|
||||
$obj->setProbability(1);
|
||||
$obj->setCause(new NullCause(1));
|
||||
$obj->setRisk(new NullRisk(1));
|
||||
$obj->probability = 1;
|
||||
$obj->cause = new NullCause(1);
|
||||
$obj->risk = new NullRisk(1);
|
||||
|
||||
SolutionMapper::create($obj);
|
||||
|
||||
$objR = SolutionMapper::get($obj->getId());
|
||||
self::assertEquals($obj->title, $objR->title);
|
||||
self::assertEquals($obj->descriptionRaw, $objR->descriptionRaw);
|
||||
self::assertEquals($obj->getProbability(), $objR->getProbability());
|
||||
self::assertEquals($obj->getRisk()->getId(), $objR->getRisk()->getId());
|
||||
self::assertEquals($obj->getCause()->getId(), $objR->getCause()->getId());
|
||||
self::assertEquals($obj->probability, $objR->probability);
|
||||
self::assertEquals($obj->risk->getId(), $objR->risk->getId());
|
||||
self::assertEquals($obj->cause->getId(), $objR->cause->getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\NullCause;
|
||||
use Modules\RiskManagement\Models\NullRisk;
|
||||
use Modules\RiskManagement\Models\Solution;
|
||||
|
||||
/**
|
||||
|
|
@ -35,32 +33,8 @@ final class SolutionTest extends \PHPUnit\Framework\TestCase
|
|||
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());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\RiskManagement\Models\Solution
|
||||
* @group module
|
||||
*/
|
||||
public function testSetGet() : void
|
||||
{
|
||||
$obj = new Solution();
|
||||
|
||||
$obj->title = 'Title';
|
||||
self::assertEquals('Title', $obj->title);
|
||||
|
||||
$obj->descriptionRaw = 'Description';
|
||||
self::assertEquals('Description', $obj->descriptionRaw);
|
||||
|
||||
$obj->setProbability(1);
|
||||
self::assertEquals(1, $obj->getProbability());
|
||||
|
||||
$obj->setCause(new NullCause(1));
|
||||
self::assertEquals(1, $obj->getCause()->getId());
|
||||
|
||||
$obj->setRisk(new NullRisk(1));
|
||||
self::assertEquals(1, $obj->getRisk()->getId());
|
||||
self::assertEquals(0, $obj->probability);
|
||||
self::assertEquals(0, $obj->cause);
|
||||
self::assertEquals(0, $obj->risk);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user