mirror of
https://github.com/Karaka-Management/oms-Organization.git
synced 2026-02-05 19:18:40 +00:00
fix tests
This commit is contained in:
parent
0e00b8ac76
commit
9fbefe76e7
|
|
@ -137,8 +137,8 @@ final class ApiController extends Controller
|
|||
$unit->descriptionRaw = $request->getDataString('description') ?? $unit->descriptionRaw;
|
||||
$unit->description = Markdown::parse($request->getDataString('description') ?? $unit->descriptionRaw);
|
||||
|
||||
$parent = (int) $request->getData('parent');
|
||||
$unit->parent = empty($parent) ? $unit->parent : new NullUnit($parent);
|
||||
$parent = $request->getDataInt('parent') ?? 0;
|
||||
$unit->parent = $parent === 0 ? $unit->parent : new NullUnit($parent);
|
||||
$unit->setStatus($request->getDataInt('status') ?? $unit->getStatus());
|
||||
|
||||
return $unit;
|
||||
|
|
|
|||
|
|
@ -43,10 +43,10 @@ class Department implements \JsonSerializable
|
|||
/**
|
||||
* Parent
|
||||
*
|
||||
* @var self
|
||||
* @var null|self
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public self $parent;
|
||||
public ?self $parent = null;
|
||||
|
||||
/**
|
||||
* Status
|
||||
|
|
@ -90,7 +90,6 @@ class Department implements \JsonSerializable
|
|||
public function __construct(string $name = '')
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->parent = new NullDepartment();
|
||||
$this->unit = new NullUnit();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,10 +43,10 @@ class Position implements \JsonSerializable
|
|||
/**
|
||||
* Parent
|
||||
*
|
||||
* @var Position
|
||||
* @var null|Position
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public self $parent;
|
||||
public ?self $parent = null;
|
||||
|
||||
/**
|
||||
* Department
|
||||
|
|
@ -87,7 +87,6 @@ class Position implements \JsonSerializable
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->parent = new NullPosition();
|
||||
$this->department = new NullDepartment();
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +128,7 @@ class Position implements \JsonSerializable
|
|||
'description' => $this->description,
|
||||
'descriptionRaw' => $this->descriptionRaw,
|
||||
'department' => $this->department ?? new NullDepartment(),
|
||||
'parent' => $this->parent ?? null,
|
||||
'parent' => $this->parent,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ class Unit implements \JsonSerializable
|
|||
/**
|
||||
* Parent
|
||||
*
|
||||
* @var Unit
|
||||
* @var null|Unit
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public self $parent;
|
||||
public ?self $parent;
|
||||
|
||||
/**
|
||||
* Description.
|
||||
|
|
@ -97,7 +97,6 @@ class Unit implements \JsonSerializable
|
|||
public function __construct()
|
||||
{
|
||||
$this->image = new NullMedia();
|
||||
$this->parent = new NullUnit();
|
||||
$this->mainAddress = new NullAddress();
|
||||
}
|
||||
|
||||
|
|
@ -150,7 +149,7 @@ class Unit implements \JsonSerializable
|
|||
'status' => $this->status,
|
||||
'description' => $this->description,
|
||||
'descriptionRaw' => $this->descriptionRaw,
|
||||
'parent' => $this->parent ?? null,
|
||||
'parent' => $this->parent,
|
||||
'image' => $this->image,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
|||
$this->app->accountManager->add($account);
|
||||
$this->app->router = new WebRouter();
|
||||
|
||||
$this->module = $this->app->moduleManager->get('Organization');
|
||||
$this->module = $this->app->moduleManager->get('Organization', 'Api');
|
||||
|
||||
TestUtils::setMember($this->module, 'app', $this->app);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user