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:
55
tests/Feature/DocumentsTest.php
Normal file
55
tests/Feature/DocumentsTest.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Tests\FeatureTestCase;
|
||||
use App\Models\Contact\Contact;
|
||||
use App\Models\Contact\Document;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class DocumentsTest extends FeatureTestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
protected $jsonStructure = [
|
||||
'id',
|
||||
'object',
|
||||
'original_filename',
|
||||
'new_filename',
|
||||
'filesize',
|
||||
'type',
|
||||
'number_of_downloads',
|
||||
'contact',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function test_it_gets_the_list_of_documents()
|
||||
{
|
||||
$user = $this->signin();
|
||||
|
||||
$contact = factory(Contact::class)->create([
|
||||
'account_id' => $user->account_id,
|
||||
]);
|
||||
|
||||
factory(Document::class, 10)->create([
|
||||
'account_id' => $user->account_id,
|
||||
'contact_id' => $contact->id,
|
||||
]);
|
||||
|
||||
$response = $this->json('GET', '/people/'.$contact->hashID().'/documents');
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$response->assertJsonStructure([
|
||||
'data' => [
|
||||
'*' => $this->jsonStructure,
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertCount(
|
||||
10,
|
||||
$response->decodeResponseJson()['data']
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user