mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 16:22:14 +00:00
Searching backend
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace Tests\Feature\Oasis;
|
||||
|
||||
use App\Models\Oasis\Client;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use App\Models\Oasis\Client;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use App\Models\User;
|
||||
use Tests\TestCase;
|
||||
|
||||
class OasisClientTest extends TestCase
|
||||
@@ -45,4 +45,32 @@ class OasisClientTest extends TestCase
|
||||
'id' => $client->id,
|
||||
])->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_search_user_client()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$client = Client::factory(Client::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
'email' => 'info@company.com',
|
||||
]);
|
||||
|
||||
$this->getJson('/api/oasis/clients/search?query=vue')
|
||||
->assertJsonFragment([
|
||||
'id' => $client->id,
|
||||
])->assertStatus(200);
|
||||
|
||||
$this->getJson('/api/oasis/clients/search?query=info')
|
||||
->assertJsonFragment([
|
||||
'id' => $client->id,
|
||||
])->assertStatus(200);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
|
||||
namespace Tests\Feature\Oasis;
|
||||
|
||||
use App\Models\Oasis\Invoice;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use App\Models\Oasis\Invoice;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use App\Models\User;
|
||||
use Tests\TestCase;
|
||||
|
||||
class OasisInvoiceTest extends TestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
use DatabaseMigrations, Queueable;
|
||||
|
||||
/**
|
||||
* @test
|
||||
@@ -143,12 +144,10 @@ class OasisInvoiceTest extends TestCase
|
||||
'invoice_type' => 'regular_invoice'
|
||||
]);
|
||||
|
||||
$response = $this->getJson('/api/oasis/invoices/regular')
|
||||
$this->getJson('/api/oasis/invoices/regular')
|
||||
->assertJsonFragment([
|
||||
'id' => $invoice->id,
|
||||
'id' => $invoice->id,
|
||||
])->assertStatus(200);
|
||||
|
||||
dd(json_decode($response->content(), true));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,7 +168,38 @@ class OasisInvoiceTest extends TestCase
|
||||
|
||||
$this->getJson('/api/oasis/invoices/advance')
|
||||
->assertJsonFragment([
|
||||
'id' => $invoice->id,
|
||||
'id' => $invoice->id,
|
||||
])->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_search_user_regular_invoice()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
Invoice::factory(Invoice::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'regular_invoice',
|
||||
'invoice_number' => 2001212,
|
||||
'client' => [
|
||||
'name' => 'VueFileManager Inc.',
|
||||
]
|
||||
]);
|
||||
|
||||
$this->getJson('/api/oasis/invoices/search?type=regular_invoice&query=2001212')
|
||||
->assertJsonFragment([
|
||||
'invoiceNumber' => '2001212',
|
||||
])->assertStatus(200);
|
||||
|
||||
$this->getJson('/api/oasis/invoices/search?type=regular_invoice&query=Vue')
|
||||
->assertJsonFragment([
|
||||
'invoiceNumber' => '2001212',
|
||||
])->assertStatus(200);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user