Skip to content
This repository has been archived by the owner on Feb 8, 2025. It is now read-only.

Commit

Permalink
feat: add date when project was marked as completed (#813)
Browse files Browse the repository at this point in the history
  • Loading branch information
djaiss authored Apr 22, 2021
1 parent e9a5cac commit 1153af4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/Services/Company/Project/CloseProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private function validate(): void
private function stopProject(): void
{
$this->project->status = Project::CLOSED;
$this->project->actually_finished_at = Carbon::now();
$this->project->save();
}

Expand Down
3 changes: 3 additions & 0 deletions tests/Unit/Services/Company/Project/CloseProjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests\Unit\Services\Company\Project;

use Carbon\Carbon;
use Tests\TestCase;
use App\Jobs\LogAccountAudit;
use App\Models\Company\Project;
Expand Down Expand Up @@ -72,6 +73,7 @@ public function it_fails_if_wrong_parameters_are_given(): void
private function executeService(Employee $michael, Project $project = null): void
{
Queue::fake();
Carbon::setTestNow(Carbon::create(2019, 1, 1));

$request = [
'company_id' => $michael->company_id,
Expand All @@ -84,6 +86,7 @@ private function executeService(Employee $michael, Project $project = null): voi
$this->assertDatabaseHas('projects', [
'id' => $project->id,
'status' => Project::CLOSED,
'actually_finished_at' => '2019-01-01 00:00:00',
]);

Queue::assertPushed(LogAccountAudit::class, function ($job) use ($michael, $project) {
Expand Down

0 comments on commit 1153af4

Please sign in to comment.