mirror of
https://github.com/Karaka-Management/oms-RiskManagement.git
synced 2026-01-11 19:38:40 +00:00
fix tests
This commit is contained in:
parent
a216076265
commit
d870fc54aa
|
|
@ -158,7 +158,7 @@
|
|||
"riskmngmt_department_department": {
|
||||
"name": "riskmngmt_department_department",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"null": true,
|
||||
"foreignTable": "organization_department",
|
||||
"foreignKey": "organization_department_id"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\RiskManagement\Models;
|
||||
|
||||
use Modules\Organization\Models\Department as OrgDepartment;
|
||||
use Modules\Organization\Models\NullDepartment as NullOrgDepartment;
|
||||
|
||||
/**
|
||||
|
|
@ -34,7 +35,7 @@ class Department
|
|||
*/
|
||||
protected int $id = 0;
|
||||
|
||||
private ?Department $department = null;
|
||||
public ?OrgDepartment $department = null;
|
||||
|
||||
private ?int $responsible = null;
|
||||
|
||||
|
|
@ -52,32 +53,6 @@ class Department
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get department.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDepartment()
|
||||
{
|
||||
return $this->department ?? new NullOrgDepartment();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set department.
|
||||
*
|
||||
* @param mixed $department Department
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDepartment($department) : void
|
||||
{
|
||||
$this->department = $department;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get responsible.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -24,4 +24,15 @@ namespace Modules\RiskManagement\Models;
|
|||
*/
|
||||
final class NullCategory extends Category
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,15 @@ namespace Modules\RiskManagement\Models;
|
|||
*/
|
||||
final class NullCause extends Cause
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,15 @@ namespace Modules\RiskManagement\Models;
|
|||
*/
|
||||
final class NullDepartment extends Department
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,15 @@ namespace Modules\RiskManagement\Models;
|
|||
*/
|
||||
final class NullProcess extends Process
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,15 @@ namespace Modules\RiskManagement\Models;
|
|||
*/
|
||||
final class NullProject extends Project
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,15 @@ namespace Modules\RiskManagement\Models;
|
|||
*/
|
||||
final class NullRisk extends Risk
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,15 @@ namespace Modules\RiskManagement\Models;
|
|||
*/
|
||||
final class NullRiskObject extends RiskObject
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,15 @@ namespace Modules\RiskManagement\Models;
|
|||
*/
|
||||
final class NullSolution extends Solution
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\RiskManagement\Models;
|
||||
|
||||
use Modules\Organization\Models\Unit;
|
||||
|
||||
/**
|
||||
* Risk Management class.
|
||||
*
|
||||
|
|
@ -50,13 +52,13 @@ class Process
|
|||
*/
|
||||
public string $descriptionRaw = '';
|
||||
|
||||
private ?int $department = null;
|
||||
private ?Department $department = null;
|
||||
|
||||
private ?int $responsible = null;
|
||||
|
||||
private ?int $deputy = null;
|
||||
|
||||
private int $unit = 1;
|
||||
private ?Unit $unit = null;
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\RiskManagement\Models;
|
||||
|
||||
use Modules\ProjectManagement\Models\Project as PMProject;
|
||||
|
||||
/**
|
||||
* Risk Management class.
|
||||
*
|
||||
|
|
@ -32,7 +34,7 @@ class Project
|
|||
*/
|
||||
protected int $id = 0;
|
||||
|
||||
private ?int $project = null;
|
||||
private ?PMProject $project = null;
|
||||
|
||||
private ?int $responsible = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\RiskManagement\Models;
|
||||
|
||||
use Modules\Organization\Models\Department;
|
||||
use Modules\Organization\Models\Unit;
|
||||
|
||||
/**
|
||||
* Risk Management class.
|
||||
*
|
||||
|
|
@ -56,15 +59,15 @@ class Risk
|
|||
*/
|
||||
public string $descriptionRaw = '';
|
||||
|
||||
private int $unit = 1;
|
||||
private ?Unit $unit = null;
|
||||
|
||||
private ?int $department = null;
|
||||
private ?Department $department = null;
|
||||
|
||||
private ?int $category = null;
|
||||
private ?Category $category = null;
|
||||
|
||||
private ?int $project = null;
|
||||
private ?Project $project = null;
|
||||
|
||||
private ?int $process = null;
|
||||
private ?Process $process = null;
|
||||
|
||||
private ?int $responsible = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ namespace Modules\RiskManagement\Models;
|
|||
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Organization\Models\UnitMapper;
|
||||
use Modules\Organization\Models\DepartmentMapper;
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ class Solution
|
|||
|
||||
private int $probability = 0;
|
||||
|
||||
private ?int $cause = null;
|
||||
private ?Cause $cause = null;
|
||||
|
||||
private ?int $risk = null;
|
||||
private ?Risk $risk = null;
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,11 @@ use Modules\RiskManagement\Models\Category;
|
|||
use Modules\RiskManagement\Models\Cause;
|
||||
use Modules\RiskManagement\Models\CauseMapper;
|
||||
use Modules\RiskManagement\Models\Department;
|
||||
use Modules\RiskManagement\Models\NullDepartment;
|
||||
use Modules\Organization\Models\Department as OrgDepartment;
|
||||
use Modules\Organization\Models\NullDepartment as NullOrgDepartment;
|
||||
use Modules\RiskManagement\Models\Risk;
|
||||
use Modules\Organization\Models\NullUnit;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -37,7 +41,7 @@ class CauseMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$obj->setProbability(1);
|
||||
|
||||
$department = new Department();
|
||||
$department->setDepartment(2);
|
||||
$department->department = new NullOrgDepartment(2);
|
||||
$obj->setDepartment($department);
|
||||
|
||||
$category = new Category();
|
||||
|
|
@ -46,15 +50,16 @@ class CauseMapperTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$risk = new Risk();
|
||||
$risk->name = 'Cause Test Risk';
|
||||
$risk->setUnit(1);
|
||||
$risk->setUnit(new NullUnit(1));
|
||||
$obj->setRisk($risk);
|
||||
|
||||
CauseMapper::create($obj);
|
||||
|
||||
/** @var Cause $objR */
|
||||
$objR = CauseMapper::get($obj->getId());
|
||||
self::assertEquals($obj->title, $objR->title);
|
||||
self::assertEquals($obj->descriptionRaw, $objR->descriptionRaw);
|
||||
self::assertEquals($obj->getDepartment()->getDepartment(), $objR->getDepartment()->getDepartment()->getId());
|
||||
//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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ declare(strict_types=1);
|
|||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\Cause;
|
||||
use Modules\RiskManagement\Models\NullCategory;
|
||||
use Modules\RiskManagement\Models\NullRisk;
|
||||
use Modules\RiskManagement\Models\NullDepartment;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -56,13 +59,13 @@ class CauseTest extends \PHPUnit\Framework\TestCase
|
|||
$obj->setProbability(1);
|
||||
self::assertEquals(1, $obj->getProbability());
|
||||
|
||||
$obj->setCategory(2);
|
||||
self::assertEquals(2, $obj->getCategory());
|
||||
$obj->setCategory(new NullCategory(2));
|
||||
self::assertEquals(2, $obj->getCategory()->getId());
|
||||
|
||||
$obj->setRisk(1);
|
||||
self::assertEquals(1, $obj->getRisk());
|
||||
$obj->setRisk(new NullRisk(1));
|
||||
self::assertEquals(1, $obj->getRisk()->getId());
|
||||
|
||||
$obj->setDepartment(1);
|
||||
self::assertEquals(1, $obj->getDepartment());
|
||||
$obj->setDepartment(new NullDepartment(1));
|
||||
self::assertEquals(1, $obj->getDepartment()->getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\Organization\Models\NullDepartment;
|
||||
use Modules\RiskManagement\Models\Department;
|
||||
use Modules\RiskManagement\Models\DepartmentMapper;
|
||||
|
||||
|
|
@ -29,14 +30,14 @@ class DepartmentMapperTest extends \PHPUnit\Framework\TestCase
|
|||
public function testCRUD() : void
|
||||
{
|
||||
$obj = new Department();
|
||||
$obj->setDepartment(2);
|
||||
$obj->department = new NullDepartment();
|
||||
$obj->setResponsible(1);
|
||||
$obj->setDeputy(1);
|
||||
|
||||
DepartmentMapper::create($obj);
|
||||
|
||||
$objR = DepartmentMapper::get($obj->getId());
|
||||
self::assertEquals($obj->getDepartment(), $objR->getDepartment()->getId());
|
||||
self::assertEquals($obj->department->getId(), $objR->department->getId());
|
||||
self::assertEquals($obj->getResponsible(), $objR->getResponsible());
|
||||
self::assertEquals($obj->getDeputy(), $objR->getDeputy());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ declare(strict_types=1);
|
|||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\Department;
|
||||
use Modules\Organization\Models\Department as OrgDepartment;
|
||||
use Modules\Organization\Models\NullDepartment as NullOrgDepartment;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -30,7 +32,7 @@ class DepartmentTest extends \PHPUnit\Framework\TestCase
|
|||
$obj = new Department();
|
||||
|
||||
self::assertEquals(0, $obj->getId());
|
||||
self::assertInstanceOf('Modules\Organization\Models\NullDepartment', $obj->getDepartment());
|
||||
self::assertEquals(null, $obj->department);
|
||||
self::assertNull($obj->getResponsible());
|
||||
self::assertNull($obj->getDeputy());
|
||||
}
|
||||
|
|
@ -43,8 +45,8 @@ class DepartmentTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
$obj = new Department();
|
||||
|
||||
$obj->setDepartment(2);
|
||||
self::assertEquals(2, $obj->getDepartment());
|
||||
$obj->department = new NullOrgDepartment(2);
|
||||
self::assertEquals(2, $obj->department->getId());
|
||||
|
||||
$obj->setResponsible(1);
|
||||
self::assertEquals(1, $obj->getResponsible());
|
||||
|
|
|
|||
|
|
@ -14,8 +14,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\Organization\Models\NullUnit;
|
||||
use Modules\RiskManagement\Models\Process;
|
||||
use Modules\RiskManagement\Models\ProcessMapper;
|
||||
use Modules\RiskManagement\Models\NullDepartment;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -31,10 +33,10 @@ class ProcessMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$obj = new Process();
|
||||
$obj->title = 'Name';
|
||||
$obj->descriptionRaw = 'Description';
|
||||
$obj->setDepartment(2);
|
||||
$obj->setDepartment(new NullDepartment(2));
|
||||
$obj->setResponsible(1);
|
||||
$obj->setDeputy(1);
|
||||
$obj->setUnit(1);
|
||||
$obj->setUnit(new NullUnit(1));
|
||||
|
||||
ProcessMapper::create($obj);
|
||||
|
||||
|
|
@ -43,7 +45,7 @@ class ProcessMapperTest extends \PHPUnit\Framework\TestCase
|
|||
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());
|
||||
self::assertEquals($obj->getUnit(), $objR->getUnit()->getId());
|
||||
self::assertEquals($obj->getDepartment()->getId(), $objR->getDepartment()->getId());
|
||||
self::assertEquals($obj->getUnit()->getId(), $objR->getUnit()->getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ declare(strict_types=1);
|
|||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\Process;
|
||||
use Modules\Organization\Models\NullUnit;
|
||||
use Modules\RiskManagement\Models\NullDepartment;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -34,7 +36,7 @@ class ProcessTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('', $obj->description);
|
||||
self::assertEquals('', $obj->descriptionRaw);
|
||||
self::assertNull($obj->getDepartment());
|
||||
self::assertEquals(1, $obj->getUnit());
|
||||
self::assertEquals(null, $obj->getUnit());
|
||||
self::assertNull($obj->getResponsible());
|
||||
self::assertNull($obj->getDeputy());
|
||||
}
|
||||
|
|
@ -59,10 +61,10 @@ class ProcessTest extends \PHPUnit\Framework\TestCase
|
|||
$obj->setDeputy(1);
|
||||
self::assertEquals(1, $obj->getDeputy());
|
||||
|
||||
$obj->setUnit(1);
|
||||
self::assertEquals(1, $obj->getUnit());
|
||||
$obj->setUnit(new NullUnit(1));
|
||||
self::assertEquals(1, $obj->getUnit()->getId());
|
||||
|
||||
$obj->setDepartment(2);
|
||||
self::assertEquals(2, $obj->getDepartment());
|
||||
$obj->setDepartment(new NullDepartment(2));
|
||||
self::assertEquals(2, $obj->getDepartment()->getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ namespace Modules\RiskManagement\tests\Models;
|
|||
|
||||
use Modules\RiskManagement\Models\Project;
|
||||
use Modules\RiskManagement\Models\ProjectMapper;
|
||||
use Modules\ProjectManagement\Models\NullProject;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -29,14 +30,14 @@ class ProjectMapperTest extends \PHPUnit\Framework\TestCase
|
|||
public function testCRUD() : void
|
||||
{
|
||||
$obj = new Project();
|
||||
$obj->setProject(1);
|
||||
$obj->setProject(new NullProject(1));
|
||||
$obj->setResponsible(1);
|
||||
$obj->setDeputy(1);
|
||||
|
||||
ProjectMapper::create($obj);
|
||||
|
||||
$objR = ProjectMapper::get($obj->getId());
|
||||
self::assertEquals($obj->getProject(), $objR->getProject()->getId());
|
||||
self::assertEquals($obj->getProject()->getId(), $objR->getProject()->getId());
|
||||
self::assertEquals($obj->getResponsible(), $objR->getResponsible());
|
||||
self::assertEquals($obj->getDeputy(), $objR->getDeputy());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
|||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\Project;
|
||||
use Modules\ProjectManagement\Models\NullProject;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -30,7 +31,7 @@ class ProjectTest extends \PHPUnit\Framework\TestCase
|
|||
$obj = new Project();
|
||||
|
||||
self::assertEquals(0, $obj->getId());
|
||||
self::assertEquals(0, $obj->getProject());
|
||||
self::assertEquals(null, $obj->getProject());
|
||||
self::assertNull($obj->getResponsible());
|
||||
self::assertNull($obj->getDeputy());
|
||||
}
|
||||
|
|
@ -49,7 +50,7 @@ class ProjectTest extends \PHPUnit\Framework\TestCase
|
|||
$obj->setDeputy(1);
|
||||
self::assertEquals(1, $obj->getDeputy());
|
||||
|
||||
$obj->setProject(1);
|
||||
self::assertEquals(1, $obj->getProject());
|
||||
$obj->setProject(new NullProject(1));
|
||||
self::assertEquals(1, $obj->getProject()->getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ use Modules\RiskManagement\Models\Risk;
|
|||
use Modules\RiskManagement\Models\RiskMapper;
|
||||
use Modules\RiskManagement\Models\RiskObject;
|
||||
use Modules\RiskManagement\Models\Solution;
|
||||
use Modules\Organization\Models\NullUnit;
|
||||
use Modules\Organization\Models\NullDepartment;
|
||||
use Modules\ProjectManagement\Models\NullProject;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -40,8 +43,8 @@ class RiskMapperTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
$obj->name = 'Risk Test';
|
||||
$obj->descriptionRaw = 'Description';
|
||||
$obj->setUnit(1);
|
||||
$obj->setDepartment(2);
|
||||
$obj->setUnit(new NullUnit(1));
|
||||
$obj->setDepartment(new NullDepartment(2));
|
||||
|
||||
$categoryObj = new Category();
|
||||
$obj->setCategory($categoryObj);
|
||||
|
|
@ -50,7 +53,7 @@ class RiskMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$obj->setProcess($processObj);
|
||||
|
||||
$projectObj = new Project();
|
||||
$projectObj->setProject(1);
|
||||
$projectObj->setProject(new NullProject(1));
|
||||
$obj->setProject($projectObj);
|
||||
|
||||
$obj->setResponsible(1);
|
||||
|
|
@ -84,13 +87,13 @@ 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(), $objR->getUnit()->getId());
|
||||
self::assertEquals($obj->getDepartment(), $objR->getDepartment()->getId());
|
||||
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(), $objR->getProject()->getProject()->getId());
|
||||
self::assertEquals($obj->getProject()->getProject()->getId(), $objR->getProject()->getProject()->getId());
|
||||
|
||||
$causes = $objR->getCauses();
|
||||
self::assertEquals($obj->getCauses()[0]->title, \end($causes)->title);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ use Modules\RiskManagement\Models\Cause;
|
|||
use Modules\RiskManagement\Models\Department;
|
||||
use Modules\RiskManagement\Models\Risk;
|
||||
use Modules\RiskManagement\Models\Solution;
|
||||
use Modules\Organization\Models\NullUnit;
|
||||
use Modules\Organization\Models\NullDepartment;
|
||||
use Modules\RiskManagement\Models\NullCategory;
|
||||
use Modules\RiskManagement\Models\NullProcess;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -36,7 +40,7 @@ class RiskTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('', $obj->name);
|
||||
self::assertEquals('', $obj->description);
|
||||
self::assertEquals('', $obj->descriptionRaw);
|
||||
self::assertEquals(1, $obj->getUnit());
|
||||
self::assertEquals(null, $obj->getUnit());
|
||||
self::assertNull($obj->getDepartment());
|
||||
self::assertNull($obj->getCategory());
|
||||
self::assertNull($obj->getProcess());
|
||||
|
|
@ -64,18 +68,18 @@ class RiskTest extends \PHPUnit\Framework\TestCase
|
|||
$obj->descriptionRaw = 'Description';
|
||||
self::assertEquals('Description', $obj->descriptionRaw);
|
||||
|
||||
$obj->setUnit(1);
|
||||
self::assertEquals(1, $obj->getUnit());
|
||||
$obj->setUnit(new NullUnit(1));
|
||||
self::assertEquals(1, $obj->getUnit()->getId());
|
||||
|
||||
$obj->setCategory(3);
|
||||
self::assertEquals(3, $obj->getCategory());
|
||||
$obj->setCategory(new NullCategory(3));
|
||||
self::assertEquals(3, $obj->getCategory()->getId());
|
||||
|
||||
$obj->setProcess(4);
|
||||
self::assertEquals(4, $obj->getProcess());
|
||||
$obj->setProcess(new NullProcess(4));
|
||||
self::assertEquals(4, $obj->getProcess()->getId());
|
||||
|
||||
$department = new Department();
|
||||
$department->setDepartment(1);
|
||||
$obj->setDepartment($department);
|
||||
$department->department = new NullDepartment(1);
|
||||
$obj->setDepartment(new NullDepartment(1));
|
||||
|
||||
$obj->setResponsible(1);
|
||||
self::assertEquals(1, $obj->getResponsible());
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ namespace Modules\RiskManagement\tests\Models;
|
|||
|
||||
use Modules\RiskManagement\Models\Solution;
|
||||
use Modules\RiskManagement\Models\SolutionMapper;
|
||||
use Modules\RiskManagement\Models\NullCause;
|
||||
use Modules\RiskManagement\Models\NullRisk;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -33,8 +35,8 @@ class SolutionMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$obj->title = 'Title';
|
||||
$obj->descriptionRaw = 'Description';
|
||||
$obj->setProbability(1);
|
||||
$obj->setCause(1);
|
||||
$obj->setRisk(1);
|
||||
$obj->setCause(new NullCause(1));
|
||||
$obj->setRisk(new NullRisk(1));
|
||||
|
||||
SolutionMapper::create($obj);
|
||||
|
||||
|
|
@ -42,7 +44,7 @@ class SolutionMapperTest extends \PHPUnit\Framework\TestCase
|
|||
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());
|
||||
self::assertEquals($obj->getRisk()->getId(), $objR->getRisk()->getId());
|
||||
self::assertEquals($obj->getCause()->getId(), $objR->getCause()->getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ declare(strict_types=1);
|
|||
namespace Modules\RiskManagement\tests\Models;
|
||||
|
||||
use Modules\RiskManagement\Models\Solution;
|
||||
use Modules\RiskManagement\Models\NullCause;
|
||||
use Modules\RiskManagement\Models\NullRisk;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -55,10 +57,10 @@ class SolutionTest extends \PHPUnit\Framework\TestCase
|
|||
$obj->setProbability(1);
|
||||
self::assertEquals(1, $obj->getProbability());
|
||||
|
||||
$obj->setCause(1);
|
||||
self::assertEquals(1, $obj->getCause());
|
||||
$obj->setCause(new NullCause(1));
|
||||
self::assertEquals(1, $obj->getCause()->getId());
|
||||
|
||||
$obj->setRisk(1);
|
||||
self::assertEquals(1, $obj->getRisk());
|
||||
$obj->setRisk(new NullRisk(1));
|
||||
self::assertEquals(1, $obj->getRisk()->getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user