mirror of
https://github.com/Karaka-Management/oms-Organization.git
synced 2026-01-11 16:18:40 +00:00
107 lines
3.2 KiB
PHP
107 lines
3.2 KiB
PHP
<?php
|
|
/**
|
|
* Orange Management
|
|
*
|
|
* PHP Version 7.4
|
|
*
|
|
* @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\tests\Organization\Models;
|
|
|
|
use Modules\Organization\Models\NullPosition;
|
|
use Modules\Organization\Models\Position;
|
|
use Modules\Organization\Models\PositionMapper;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
class PositionMapperTest extends \PHPUnit\Framework\TestCase
|
|
{
|
|
public function testCRUD() : void
|
|
{
|
|
$position = new Position();
|
|
$position->setName('CEO');
|
|
$position->setDescription('Description');
|
|
|
|
$id = PositionMapper::create($position);
|
|
|
|
$positionR = PositionMapper::get($id);
|
|
self::assertEquals($id, $positionR->getId());
|
|
self::assertEquals($position->getName(), $positionR->getName());
|
|
self::assertEquals($position->getDescription(), $positionR->getDescription());
|
|
self::assertInstanceOf('Modules\Organization\Models\NullPosition', $positionR->getParent());
|
|
}
|
|
|
|
/**
|
|
* @group volume
|
|
* @slowThreshold 15000
|
|
* @group module
|
|
*/
|
|
public function testVolume() : void
|
|
{
|
|
$first = 2;
|
|
|
|
/* 4 */
|
|
$position = new Position();
|
|
$position->setName('CFO');
|
|
$position->setDescription('Description');
|
|
$position->setParent(new NullPosition($first));
|
|
$id = PositionMapper::create($position);
|
|
|
|
/* 5 */
|
|
$position = new Position();
|
|
$position->setName('Accountant');
|
|
$position->setDescription('Description');
|
|
$position->setParent(new NullPosition($id));
|
|
PositionMapper::create($position);
|
|
|
|
/* 6 */
|
|
$position = new Position();
|
|
$position->setName('Controller');
|
|
$position->setDescription('Description');
|
|
$position->setParent(new NullPosition($id));
|
|
PositionMapper::create($position);
|
|
|
|
/* 7 */
|
|
$position = new Position();
|
|
$position->setName('Sales Director');
|
|
$position->setDescription('Description');
|
|
$position->setParent(new NullPosition($first));
|
|
PositionMapper::create($position);
|
|
|
|
/* 8 */
|
|
$position = new Position();
|
|
$position->setName('Purchase Director');
|
|
$position->setDescription('Description');
|
|
$position->setParent(new NullPosition($first));
|
|
PositionMapper::create($position);
|
|
|
|
/* 9 */
|
|
$position = new Position();
|
|
$position->setName('Territory Manager');
|
|
$position->setDescription('Description');
|
|
$position->setParent(new NullPosition($first + 4));
|
|
PositionMapper::create($position);
|
|
|
|
/* 10 */
|
|
$position = new Position();
|
|
$position->setName('Territory Sales Assistant');
|
|
$position->setDescription('Description');
|
|
$position->setParent(new NullPosition($first + 6));
|
|
PositionMapper::create($position);
|
|
|
|
/* 11 */
|
|
$position = new Position();
|
|
$position->setName('Domestic Sales Manager');
|
|
$position->setDescription('Description');
|
|
$position->setParent(new NullPosition($first + 4));
|
|
PositionMapper::create($position);
|
|
}
|
|
}
|