refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s

This commit is contained in:
Kroonk
2026-05-22 16:19:55 +02:00
parent 38cc4c09ca
commit a213a1dba0
2215 changed files with 242567 additions and 6015 deletions

View File

@@ -0,0 +1,44 @@
<?php
namespace Tests\Unit\Helpers;
use Tests\TestCase;
use App\Models\User\User;
use App\Models\Settings\Term;
use App\Helpers\ComplianceHelper;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ComplianceHelperTest extends TestCase
{
use DatabaseTransactions;
/** @test */
public function it_checks_if_the_user_has_signed_the_given_term()
{
$user = factory(User::class)->create([]);
$term = factory(Term::class)->create([]);
$this->assertFalse(ComplianceHelper::hasSignedGivenTerm($user, $term));
$term = factory(Term::class)->create([]);
$user->terms()->sync([$term->id => ['account_id' => $user->account_id]]);
$this->assertTrue(ComplianceHelper::hasSignedGivenTerm($user, $term));
}
/** @test */
public function it_checks_if_the_user_has_signed_the_latest_term()
{
$user = factory(User::class)->create([]);
$term = factory(Term::class)->create([
'created_at' => '1990-02-07 02:26:07',
]);
$this->assertFalse(ComplianceHelper::isCompliantWithCurrentTerm($user));
$term = factory(Term::class)->create([
'created_at' => '2020-02-07 02:26:07',
]);
$user->terms()->syncWithoutDetaching([$term->id => ['account_id' => $user->account_id]]);
$this->assertTrue(ComplianceHelper::isCompliantWithCurrentTerm($user));
}
}