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