Skip to content

Commit

Permalink
PHP Linting (Pint) - Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
sampoyigi authored and github-actions[bot] committed Aug 10, 2024
1 parent b30066e commit c6fa51e
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion src/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ protected function createModel()
throw new \LogicException(sprintf('Missing model [%s] in %s', $modelClass, get_called_class()));
}

return new $modelClass();
return new $modelClass;
}

//
Expand Down
2 changes: 1 addition & 1 deletion src/CartItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function hasConditions()

public function clearConditions()
{
$this->conditions = new CartItemConditions();
$this->conditions = new CartItemConditions;

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function boot()
});

Statistics::registerCards(function() {
return (new RegistersDashboardCards())();
return (new RegistersDashboardCards)();
});
}

Expand Down
14 changes: 7 additions & 7 deletions tests/AutomationRules/Conditions/OrderAttributeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Igniter\Cart\Models\Order;

it('defines model attributes correctly', function() {
$orderAttribute = new OrderAttribute();
$orderAttribute = new OrderAttribute;

$attributes = $orderAttribute->defineModelAttributes();

Expand All @@ -25,7 +25,7 @@
'order_time' => Carbon::now()->subHours(5)->toTimeString(),
]);

$orderAttribute = new OrderAttribute();
$orderAttribute = new OrderAttribute;

expect($orderAttribute->getHoursSinceAttribute(null, $order))->toBe(5.0);
});
Expand All @@ -37,7 +37,7 @@
'order_time' => Carbon::now()->addHours(5)->toTimeString(),
]);

$orderAttribute = new OrderAttribute();
$orderAttribute = new OrderAttribute;

expect($orderAttribute->getHoursUntilAttribute(null, $order))->toBe(4.0);
});
Expand All @@ -49,7 +49,7 @@
'order_time' => Carbon::now()->toTimeString(),
]);

$orderAttribute = new OrderAttribute();
$orderAttribute = new OrderAttribute;

expect($orderAttribute->getDaysSinceAttribute(null, $order))->toBe(3.0);
});
Expand All @@ -60,21 +60,21 @@
'order_time' => Carbon::now()->toTimeString(),
]);

$orderAttribute = new OrderAttribute();
$orderAttribute = new OrderAttribute;

expect($orderAttribute->getDaysUntilAttribute(null, $order))->toBe(3.0);
});

it('gets history status id correctly', function() {
$orderAttribute = new OrderAttribute();
$orderAttribute = new OrderAttribute;
$order = Mockery::mock(Order::class);
$order->shouldReceive('status_history->pluck')->andReturn(collect([1, 2, 3]));

expect($orderAttribute->getHistoryStatusIdAttribute(null, $order))->toBe('1,2,3');
});

it('throws exception when no order in params', function() {
$orderAttribute = new OrderAttribute();
$orderAttribute = new OrderAttribute;

$this->expectException(\Igniter\Automation\AutomationException::class);

Expand Down
4 changes: 2 additions & 2 deletions tests/AutomationRules/Conditions/OrderStatusAttributeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
use Igniter\Cart\AutomationRules\Conditions\OrderStatusAttribute;

it('defines model attributes correctly', function() {
$orderStatusAttribute = new OrderStatusAttribute();
$orderStatusAttribute = new OrderStatusAttribute;

$attributes = $orderStatusAttribute->defineModelAttributes();

expect($attributes)->toHaveKeys(['status_id', 'status_name', 'notify_customer']);
});

it('throws exception when no status in params', function() {
$orderStatusAttribute = new OrderStatusAttribute();
$orderStatusAttribute = new OrderStatusAttribute;

$this->expectException(AutomationException::class);

Expand Down
4 changes: 2 additions & 2 deletions tests/AutomationRules/Events/NewOrderStatusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Igniter\Cart\Models\Order;

it('has a name and description', function() {
$event = new NewOrderStatus();
$event = new NewOrderStatus;
expect($event->eventDetails())->toHaveKeys(['name', 'description']);
});

Expand All @@ -31,7 +31,7 @@

expect($params)->toBeArray()->not->toHaveKey('order');

$params = NewOrderStatus::makeParamsFromEvent([new \stdClass()]);
$params = NewOrderStatus::makeParamsFromEvent([new \stdClass]);

expect($params)->toBeArray()->not->toHaveKey('order');
});
4 changes: 2 additions & 2 deletions tests/AutomationRules/Events/OrderAssignedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Igniter\User\Models\User;

it('has a name and description', function() {
$event = new OrderAssigned();
$event = new OrderAssigned;
expect($event->eventDetails())->toHaveKeys(['name', 'description']);
});

Expand All @@ -34,7 +34,7 @@

expect($params)->toBeArray()->not->toHaveKey('order');

$params = OrderAssigned::makeParamsFromEvent([new \stdClass()]);
$params = OrderAssigned::makeParamsFromEvent([new \stdClass]);

expect($params)->toBeArray()->not->toHaveKey('order');
});
Expand Down
4 changes: 2 additions & 2 deletions tests/AutomationRules/Events/OrderPlacedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Igniter\Cart\Models\Order;

it('has a name and description', function() {
$event = new OrderPlaced();
$event = new OrderPlaced;
expect($event->eventDetails())->toHaveKeys(['name', 'description']);
});

Expand All @@ -31,7 +31,7 @@

expect($params)->toBeArray()->not->toHaveKey('order');

$params = OrderPlaced::makeParamsFromEvent([new \stdClass()]);
$params = OrderPlaced::makeParamsFromEvent([new \stdClass]);

expect($params)->toBeArray()->not->toHaveKey('order');
});
Expand Down
10 changes: 5 additions & 5 deletions tests/Classes/CartConditionManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Igniter\Cart\Tests\Classes\Fixtures\TestCartCondition;

it('makes condition', function() {
$manager = new CartConditionManager();
$manager = new CartConditionManager;
$manager->registerCondition(TestCartCondition::class, [
'name' => 'testCartCondition',
'label' => 'Test Cart Condition',
Expand All @@ -19,13 +19,13 @@
});

it('throws exception for unregistered condition', function() {
$manager = new CartConditionManager();
$manager = new CartConditionManager;

expect(fn() => $manager->makeCondition('NonExistentClass'))->toThrow(\LogicException::class);
});

it('lists registered conditions', function() {
$manager = new CartConditionManager();
$manager = new CartConditionManager;
$manager->registerCondition(TestCartCondition::class, [
'name' => 'testCartCondition',
'label' => 'Test Cart Condition',
Expand All @@ -38,7 +38,7 @@
});

it('loads registered conditions', function() {
$manager = new CartConditionManager();
$manager = new CartConditionManager;
$manager->registerCallback(function($manager) {
$manager->registerCondition(TestCartCondition::class, [
'name' => 'testCartCondition',
Expand All @@ -54,7 +54,7 @@
});

it('registers conditions', function() {
$manager = new CartConditionManager();
$manager = new CartConditionManager;
$manager->registerConditions([
TestCartCondition::class => [
'name' => 'testCartCondition',
Expand Down
2 changes: 1 addition & 1 deletion tests/Classes/CartManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$this->location = LocationModel::factory()->create();
resolve('location')->setModel($this->location);

$this->manager = new CartManager();
$this->manager = new CartManager;
});

it('gets cart', function() {
Expand Down
2 changes: 1 addition & 1 deletion tests/Classes/OrderManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
resolve('location')->setModel($this->location);

$this->customer = Customer::factory()->create();
$this->manager = new OrderManager();
$this->manager = new OrderManager;
});

it('gets customer id', function() {
Expand Down
14 changes: 7 additions & 7 deletions tests/Classes/OrderTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
use Illuminate\Support\Collection;

it('makes order types', function() {
$orderTypes = new OrderTypes();
$location = new LocationModel();
$orderTypes = new OrderTypes;
$location = new LocationModel;

$result = $orderTypes->makeOrderTypes($location);

expect($result)->toBeInstanceOf(Collection::class);
});

it('gets order type', function() {
$orderTypes = new OrderTypes();
$orderTypes = new OrderTypes;

$result = $orderTypes->getOrderType('delivery');

Expand All @@ -28,15 +28,15 @@
});

it('lists order types', function() {
$orderTypes = new OrderTypes();
$orderTypes = new OrderTypes;

$result = $orderTypes->listOrderTypes();

expect($result)->toBeArray();
});

it('registers order types', function() {
$orderTypes = new OrderTypes();
$orderTypes = new OrderTypes;

$orderTypes->registerOrderTypes([
Delivery::class => ['code' => 'delivery', 'name' => 'Delivery'],
Expand All @@ -48,7 +48,7 @@
});

it('registers order type', function() {
$orderTypes = new OrderTypes();
$orderTypes = new OrderTypes;

$orderTypes->registerOrderType(Delivery::class, ['code' => 'delivery', 'name' => 'Delivery']);

Expand All @@ -58,7 +58,7 @@
});

it('registers callback', function() {
$orderTypes = new OrderTypes();
$orderTypes = new OrderTypes;

$orderTypes->registerCallback(function($orderTypes) {
$orderTypes->registerOrderType('TestOrderType', ['code' => 'test']);
Expand Down
24 changes: 12 additions & 12 deletions tests/Http/Middleware/CartMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
Location::shouldReceive('getId')->andReturn(1);
Cart::shouldReceive('instance')->with('location-1');

$middleware = new CartMiddleware();
$response = $middleware->handle(new Request(), function() {
$middleware = new CartMiddleware;
$response = $middleware->handle(new Request, function() {
return true;
});

Expand All @@ -31,8 +31,8 @@
Location::shouldReceive('current')->andReturn(null);
Cart::expects('instance')->never();

$middleware = new CartMiddleware();
$response = $middleware->handle(new Request(), function() {
$middleware = new CartMiddleware;
$response = $middleware->handle(new Request, function() {
return true;
});

Expand All @@ -49,26 +49,26 @@
Auth::shouldReceive('getUser')->andReturn($userMock);
Cart::shouldReceive('store')->with(1);

$middleware = new CartMiddleware();
expect($middleware->terminate(new Request(), new Response()))->toBeNull();
$middleware = new CartMiddleware;
expect($middleware->terminate(new Request, new Response))->toBeNull();
});

it('terminates without abandoned cart', function() {
CartSettings::set('abandoned_cart', false);
Auth::expects('check')->never();
Cart::expects('store')->never();

$middleware = new CartMiddleware();
expect($middleware->terminate(new Request(), new Response()))->toBeNull();
$middleware = new CartMiddleware;
expect($middleware->terminate(new Request, new Response))->toBeNull();
});

it('terminates with abandoned cart but unauthenticated user', function() {
CartSettings::set('abandoned_cart', true);
Auth::shouldReceive('check')->andReturn(false);
Cart::expects('content')->never();

$middleware = new CartMiddleware();
expect($middleware->terminate(new Request(), new Response()))->toBeNull();
$middleware = new CartMiddleware;
expect($middleware->terminate(new Request, new Response))->toBeNull();
});

it('terminates with abandoned cart, authenticated user but empty cart', function() {
Expand All @@ -77,6 +77,6 @@
Cart::shouldReceive('content')->andReturn(collect());
Cart::expects('store')->never();

$middleware = new CartMiddleware();
expect($middleware->terminate(new Request(), new Response()))->toBeNull();
$middleware = new CartMiddleware;
expect($middleware->terminate(new Request, new Response))->toBeNull();
});
8 changes: 4 additions & 4 deletions tests/Models/CategoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
});

it('belongs to parent category', function() {
$category = new Category();
$category = new Category;
$relation = $category->parent_cat();

expect($relation->getRelated())->toBeInstanceOf(Category::class)
Expand All @@ -46,15 +46,15 @@
});

it('belongs to many menus', function() {
$category = new Category();
$category = new Category;
$relation = $category->menus();

expect($relation->getRelated())->toBeInstanceOf(Menu::class)
->and($relation->getTable())->toBe('menu_categories');
});

it('morphs to many locations', function() {
$category = new Category();
$category = new Category;
$relation = $category->locations();

expect($relation->getMorphType())->toBe('locationable_type')
Expand Down Expand Up @@ -90,7 +90,7 @@
});

it('configures category model correctly', function() {
$category = new Category();
$category = new Category;

expect(class_uses_recursive($category))
->toContain(HasMedia::class)
Expand Down
4 changes: 2 additions & 2 deletions tests/Models/IngredientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
});

it('morphs to many menus', function() {
$ingredient = new Ingredient();
$ingredient = new Ingredient;
$relation = $ingredient->menus();

expect($relation->getRelated())->toBeInstanceOf(Menu::class)
->and($relation->getTable())->toBe('ingredientables');
});

it('morphs to many menu option values', function() {
$ingredient = new Ingredient();
$ingredient = new Ingredient;
$relation = $ingredient->menu_option_values();

expect($relation->getRelated())->toBeInstanceOf(MenuOptionValue::class)
Expand Down
Loading

0 comments on commit c6fa51e

Please sign in to comment.