refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
This commit is contained in:
62
tests/Unit/Services/DavClient/SynchronizeAddressBookTest.php
Normal file
62
tests/Unit/Services/DavClient/SynchronizeAddressBookTest.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\DavClient;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Mockery\MockInterface;
|
||||
use App\Models\Account\AddressBookSubscription;
|
||||
use App\Services\DavClient\SynchronizeAddressBook;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use App\Services\DavClient\Utils\AddressBookSynchronizer;
|
||||
|
||||
class SynchronizeAddressBookTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
/** @test */
|
||||
public function it_runs_sync()
|
||||
{
|
||||
$this->mock(AddressBookSynchronizer::class, function (MockInterface $mock) {
|
||||
$mock->shouldReceive('execute')
|
||||
->once()
|
||||
->withArgs(function ($sync, $force) {
|
||||
$this->assertFalse($force);
|
||||
|
||||
return true;
|
||||
});
|
||||
});
|
||||
|
||||
$subscription = AddressBookSubscription::factory()->create();
|
||||
|
||||
$request = [
|
||||
'account_id' => $subscription->account_id,
|
||||
'addressbook_subscription_id' => $subscription->id,
|
||||
];
|
||||
|
||||
(new SynchronizeAddressBook())->execute($request);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_runs_sync_force()
|
||||
{
|
||||
$this->mock(AddressBookSynchronizer::class, function (MockInterface $mock) {
|
||||
$mock->shouldReceive('execute')
|
||||
->once()
|
||||
->withArgs(function ($sync, $force) {
|
||||
$this->assertTrue($force);
|
||||
|
||||
return true;
|
||||
});
|
||||
});
|
||||
|
||||
$subscription = AddressBookSubscription::factory()->create();
|
||||
|
||||
$request = [
|
||||
'account_id' => $subscription->account_id,
|
||||
'addressbook_subscription_id' => $subscription->id,
|
||||
'force' => true,
|
||||
];
|
||||
|
||||
(new SynchronizeAddressBook())->execute($request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user