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.
This commit is contained in:
@@ -18,20 +18,20 @@ uses(RefreshDatabase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
Config::set('ecommerce.api.token', 'test-token');
|
||||
|
||||
|
||||
$this->user = User::factory()->create([
|
||||
'password' => 'password',
|
||||
'phone_number' => 61929248,
|
||||
]);
|
||||
|
||||
|
||||
// Create tmpost channel required by OrderRepository
|
||||
if (Channel::where('slug', 'tmpost')->doesntExist()) {
|
||||
Channel::create(['slug' => 'tmpost', 'name' => 'TM Post']);
|
||||
}
|
||||
|
||||
|
||||
// Mock default payment type for OrderPayment::default()
|
||||
if (PaymentType::count() === 0) {
|
||||
$paymentType = new PaymentType();
|
||||
$paymentType = new PaymentType;
|
||||
$paymentType->forceFill([
|
||||
'id' => 1,
|
||||
'code' => 'cash',
|
||||
@@ -44,7 +44,7 @@ beforeEach(function () {
|
||||
});
|
||||
|
||||
test('authenticated user can list their orders', function () {
|
||||
$order = new Order();
|
||||
$order = new Order;
|
||||
$order->forceFill([
|
||||
'user_id' => $this->user->id,
|
||||
'number' => 'ORD-123',
|
||||
@@ -71,8 +71,8 @@ test('authenticated user can list their orders', function () {
|
||||
'id',
|
||||
'number',
|
||||
// Add other fields from OrderIndexResource
|
||||
]
|
||||
]
|
||||
],
|
||||
],
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -186,7 +186,7 @@ test('order validation fails with invalid data', function () {
|
||||
});
|
||||
|
||||
test('can show specific order', function () {
|
||||
$order = new Order();
|
||||
$order = new Order;
|
||||
$order->forceFill([
|
||||
'user_id' => $this->user->id,
|
||||
'number' => 'ORD-SHOW',
|
||||
@@ -214,8 +214,8 @@ test('can show specific order', function () {
|
||||
test('can delete order (if allowed)', function () {
|
||||
// Note: The controller destroy method is basically empty: return response()->rest();
|
||||
// But the route exists. Let's test it returns 200 at least.
|
||||
|
||||
$order = new Order();
|
||||
|
||||
$order = new Order;
|
||||
$order->forceFill([
|
||||
'user_id' => $this->user->id,
|
||||
'number' => 'ORD-DEL',
|
||||
@@ -236,7 +236,7 @@ test('can delete order (if allowed)', function () {
|
||||
->deleteJson("/api/v1/orders/{$order->id}");
|
||||
|
||||
$response->assertOk();
|
||||
|
||||
|
||||
$this->assertSoftDeleted('orders', [
|
||||
'id' => $order->id,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user