Files
postshop-backend/tests/Feature/Api/V1/Order/OrderSettingsTest.php
Mekan1206 c46eccb24f Refactor code for improved readability and consistency
- Removed unnecessary blank lines in various files to enhance code clarity.
- Updated comments for consistency and clarity across multiple classes and methods.
- Adjusted spacing in test files for better formatting and readability.
2026-02-08 02:24:43 +05:00

51 lines
1.3 KiB
PHP

<?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'));
});