cs fixes, bug fixes, code coverage

This commit is contained in:
Dennis Eichhorn 2021-11-16 00:05:43 +01:00
parent 5c24838e95
commit b9faddf05a
4 changed files with 35 additions and 39 deletions

View File

@ -12,9 +12,7 @@ If you have a good idea for improvement feel free to create a new issue with all
### Issues ### 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. 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.
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]`.
### Code Style ### Code Style

View File

@ -18,7 +18,6 @@ use Modules\Admin\Models\Account;
use Modules\Admin\Models\NullAccount; use Modules\Admin\Models\NullAccount;
use Modules\Calendar\Models\Calendar; use Modules\Calendar\Models\Calendar;
use Modules\Media\Models\Media; use Modules\Media\Models\Media;
use Modules\Media\Models\NullMedia;
use Modules\Tasks\Models\Task; use Modules\Tasks\Models\Task;
use phpOMS\Localization\Money; use phpOMS\Localization\Money;
@ -380,21 +379,21 @@ class Project
public function toArray() : array public function toArray() : array
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
'start' => $this->start, 'start' => $this->start,
'end' => $this->end, 'end' => $this->end,
'name' => $this->name, 'name' => $this->name,
'description' => $this->description, 'description' => $this->description,
'calendar' => $this->calendar, 'calendar' => $this->calendar,
'costs' => $this->costs, 'costs' => $this->costs,
'budgetCosts' => $this->budgetCosts, 'budgetCosts' => $this->budgetCosts,
'budgetEarnings' => $this->budgetEarnings, 'budgetEarnings' => $this->budgetEarnings,
'earnings' => $this->earnings, 'earnings' => $this->earnings,
'tasks' => $this->tasks, 'tasks' => $this->tasks,
'media' => $this->media, 'media' => $this->media,
'progress' => $this->progress, 'progress' => $this->progress,
'progressType' => $this->progressType, 'progressType' => $this->progressType,
'createdAt' => $this->createdAt, 'createdAt' => $this->createdAt,
]; ];
} }

View File

@ -21,7 +21,6 @@ use Modules\ProjectManagement\Models\Project;
use Modules\ProjectManagement\Models\ProjectMapper; use Modules\ProjectManagement\Models\ProjectMapper;
use Modules\Tasks\Models\Task; use Modules\Tasks\Models\Task;
use phpOMS\Localization\Money; use phpOMS\Localization\Money;
use phpOMS\Utils\RnG\Text;
/** /**
* @internal * @internal
@ -39,16 +38,16 @@ final class ProjectMapperTest extends \PHPUnit\Framework\TestCase
$project->setName('Projectname'); $project->setName('Projectname');
$project->description = 'Description'; $project->description = 'Description';
$project->createdBy = new NullAccount(1); $project->createdBy = new NullAccount(1);
$project->start = new \DateTime('2000-05-05'); $project->start = new \DateTime('2000-05-05');
$project->end = new \DateTime('2005-05-05'); $project->end = new \DateTime('2005-05-05');
$money = new Money(); $money = new Money();
$money->setString('1.23'); $money->setString('1.23');
$project->costs = $money; $project->costs = $money;
$project->budgetCosts = $money; $project->budgetCosts = $money;
$project->budgetEarnings = $money; $project->budgetEarnings = $money;
$project->earnings = $money; $project->earnings = $money;
$task = new Task(); $task = new Task();
$task->title = 'ProjectTask 1'; $task->title = 'ProjectTask 1';

View File

@ -15,9 +15,9 @@ declare(strict_types=1);
namespace Modules\ProjectManagement\tests\Models; namespace Modules\ProjectManagement\tests\Models;
use Modules\Admin\Models\NullAccount; use Modules\Admin\Models\NullAccount;
use Modules\Media\Models\Media;
use Modules\ProjectManagement\Models\ProgressType; use Modules\ProjectManagement\Models\ProgressType;
use Modules\ProjectManagement\Models\Project; use Modules\ProjectManagement\Models\Project;
use Modules\Media\Models\Media;
use Modules\Tasks\Models\Task; use Modules\Tasks\Models\Task;
use phpOMS\Localization\Money; use phpOMS\Localization\Money;
@ -62,7 +62,7 @@ final class ProjectTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\Modules\Tasks\Models\Task', $this->project->getTask(0)); self::assertInstanceOf('\Modules\Tasks\Models\Task', $this->project->getTask(0));
} }
/** /**
* @covers Modules\ProjectManagement\Models\Project * @covers Modules\ProjectManagement\Models\Project
* @group module * @group module
*/ */
@ -165,7 +165,7 @@ final class ProjectTest extends \PHPUnit\Framework\TestCase
$this->project->description = 'Description'; $this->project->description = 'Description';
$this->project->start = new \DateTime(); $this->project->start = new \DateTime();
$this->project->end = new \DateTime(); $this->project->end = new \DateTime();
$this->project->progress = 10; $this->project->progress = 10;
$this->project->setProgressType(ProgressType::TASKS); $this->project->setProgressType(ProgressType::TASKS);
$serialized = $this->project->jsonSerialize(); $serialized = $this->project->jsonSerialize();
@ -174,19 +174,19 @@ final class ProjectTest extends \PHPUnit\Framework\TestCase
self::assertEquals( self::assertEquals(
[ [
'id' => 0, 'id' => 0,
'start' => $this->project->start, 'start' => $this->project->start,
'end' => $this->project->end, 'end' => $this->project->end,
'name' => 'Name', 'name' => 'Name',
'description' => 'Description', 'description' => 'Description',
'costs' => new Money(), 'costs' => new Money(),
'budgetCosts' => new Money(), 'budgetCosts' => new Money(),
'budgetEarnings' => new Money(), 'budgetEarnings' => new Money(),
'earnings' => new Money(), 'earnings' => new Money(),
'tasks' => [], 'tasks' => [],
'media' => [], 'media' => [],
'progress' => 10, 'progress' => 10,
'progressType' => ProgressType::TASKS, 'progressType' => ProgressType::TASKS,
], ],
$serialized $serialized
); );