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
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.
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]`.
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.
### Code Style

View File

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

View File

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

View File

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