reupload
This commit is contained in:
50
tests/Feature/Api/V1/Order/OrderSettingsTest.php
Normal file
50
tests/Feature/Api/V1/Order/OrderSettingsTest.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use App\Models\System\Settings\Payments\PaymentType;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
Config::set('ecommerce.api.token', 'test-token');
|
||||
});
|
||||
|
||||
test('can get order available times', function () {
|
||||
// Act
|
||||
$response = $this->withHeaders([
|
||||
'Api-Token' => 'test-token',
|
||||
'Accept' => 'application/json',
|
||||
])->getJson('/api/v1/order-time');
|
||||
|
||||
// Assert
|
||||
$response->assertOk();
|
||||
// Structure depends on OrderRepository::availableTimes() implementation
|
||||
// Assuming it returns an array of times or dates
|
||||
$this->assertIsArray($response->json('data'));
|
||||
});
|
||||
|
||||
test('can list order payment types', function () {
|
||||
// Arrange
|
||||
PaymentType::create(['name' => 'Cash']);
|
||||
PaymentType::create(['name' => 'Card']);
|
||||
|
||||
// Act
|
||||
$response = $this->withHeaders([
|
||||
'Api-Token' => 'test-token',
|
||||
'Accept' => 'application/json',
|
||||
])->getJson('/api/v1/order-payments');
|
||||
|
||||
// Assert
|
||||
$response->assertOk()
|
||||
->assertJsonStructure([
|
||||
'data' => [
|
||||
'*' => [
|
||||
'id',
|
||||
'name',
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
||||
$this->assertCount(2, $response->json('data'));
|
||||
});
|
||||
Reference in New Issue
Block a user