Skip to content

Commit

Permalink
fix flaky tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Jan 4, 2025
1 parent 945ec00 commit e38cb0f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 171 deletions.
170 changes: 0 additions & 170 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ parameters:
count: 1
path: src/ApiResources/Transformers/CouponsTransformer.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$code\\.$#"
count: 1
path: src/CartConditions/Coupon.php

-
message: "#^Access to an undefined property Illuminate\\\\Support\\\\Optional\\:\\:\\$discount\\.$#"
count: 2
Expand Down Expand Up @@ -65,51 +60,11 @@ parameters:
count: 1
path: src/CartConditions/Coupon.php

-
message: "#^Call to an undefined static method Igniter\\\\Cart\\\\Facades\\\\Cart\\:\\:content\\(\\)\\.$#"
count: 1
path: src/CartConditions/Coupon.php

-
message: "#^Call to an undefined static method Igniter\\\\Cart\\\\Facades\\\\Cart\\:\\:subtotal\\(\\)\\.$#"
count: 2
path: src/CartConditions/Coupon.php

-
message: "#^Call to an undefined static method Igniter\\\\Cart\\\\Models\\\\Menu\\:\\:whereHasCategory\\(\\)\\.$#"
count: 1
path: src/CartConditions/Coupon.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:coveredArea\\(\\)\\.$#"
count: 1
path: src/CartConditions/Coupon.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:getId\\(\\)\\.$#"
count: 1
path: src/CartConditions/Coupon.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:orderDateTime\\(\\)\\.$#"
count: 1
path: src/CartConditions/Coupon.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:orderType\\(\\)\\.$#"
count: 1
path: src/CartConditions/Coupon.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:orderTypeIsDelivery\\(\\)\\.$#"
count: 1
path: src/CartConditions/Coupon.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:getUser\\(\\)\\.$#"
count: 1
path: src/CartConditions/Coupon.php

-
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Builder\\<Igniter\\\\Coupons\\\\Models\\\\Coupon\\>\\:\\:isEnabled\\(\\)\\.$#"
count: 1
Expand All @@ -125,21 +80,6 @@ parameters:
count: 1
path: src/Extension.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:getId\\(\\)\\.$#"
count: 1
path: src/Extension.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:orderDateTime\\(\\)\\.$#"
count: 1
path: src/Extension.php

-
message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\AdminMenu\\:\\:setContext\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Coupons.php

-
message: "#^Access to an undefined property Igniter\\\\Cart\\\\Models\\\\Order\\:\\:\\$model\\.$#"
count: 1
Expand All @@ -155,96 +95,21 @@ parameters:
count: 1
path: src/Models/Actions/RedeemsCoupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$apply_coupon_on\\.$#"
count: 3
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$customer_groups\\.$#"
count: 1
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$customer_redemptions\\.$#"
count: 1
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$customers\\.$#"
count: 1
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$discount\\.$#"
count: 3
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$fixed_date\\.$#"
count: 2
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$fixed_from_time\\.$#"
count: 1
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$fixed_to_time\\.$#"
count: 1
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$locations\\.$#"
count: 1
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$min_total\\.$#"
count: 1
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$period_end_date\\.$#"
count: 1
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$period_start_date\\.$#"
count: 1
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$recurring_every\\.$#"
count: 1
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$recurring_from_time\\.$#"
count: 1
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$recurring_to_time\\.$#"
count: 1
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$redemptions\\.$#"
count: 1
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$type\\.$#"
count: 3
path: src/Models/Coupon.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:\\$validity\\.$#"
count: 1
path: src/Models/Coupon.php

-
message: "#^Call to an undefined method Igniter\\\\Coupons\\\\Models\\\\Coupon\\:\\:categories\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -285,46 +150,11 @@ parameters:
count: 1
path: src/Models/CouponHistory.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\CouponHistory\\:\\:\\$amount\\.$#"
count: 1
path: src/Models/CouponHistory.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\CouponHistory\\:\\:\\$code\\.$#"
count: 1
path: src/Models/CouponHistory.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\CouponHistory\\:\\:\\$coupon_id\\.$#"
count: 1
path: src/Models/CouponHistory.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\CouponHistory\\:\\:\\$customer\\.$#"
count: 1
path: src/Models/CouponHistory.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\CouponHistory\\:\\:\\$customer_id\\.$#"
count: 1
path: src/Models/CouponHistory.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\CouponHistory\\:\\:\\$min_total\\.$#"
count: 1
path: src/Models/CouponHistory.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\CouponHistory\\:\\:\\$order_id\\.$#"
count: 1
path: src/Models/CouponHistory.php

-
message: "#^Access to an undefined property Igniter\\\\Coupons\\\\Models\\\\CouponHistory\\:\\:\\$status\\.$#"
count: 1
path: src/Models/CouponHistory.php

-
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$coupon_history_id\\.$#"
count: 1
Expand Down
28 changes: 28 additions & 0 deletions src/Models/Coupon.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,34 @@

/**
* Coupons Model Class
*
* @property int $coupon_id
* @property string $name
* @property string $code
* @property string $type
* @property float|null $discount
* @property float|null $min_total
* @property int $redemptions
* @property int $customer_redemptions
* @property string|null $description
* @property bool|null $status
* @property \Illuminate\Support\Carbon $created_at
* @property string|null $validity
* @property \Illuminate\Support\Carbon|null $fixed_date
* @property mixed|null $fixed_from_time
* @property mixed|null $fixed_to_time
* @property \Illuminate\Support\Carbon|null $period_start_date
* @property \Illuminate\Support\Carbon|null $period_end_date
* @property string|null $recurring_every
* @property mixed|null $recurring_from_time
* @property mixed|null $recurring_to_time
* @property array|null $order_restriction
* @property string $apply_coupon_on
* @property bool $auto_apply
* @property \Illuminate\Support\Carbon $updated_at
* @property-read mixed $formatted_discount
* @property-read mixed $type_name
* @mixin \Igniter\Flame\Database\Model
*/
class Coupon extends Model
{
Expand Down
13 changes: 13 additions & 0 deletions src/Models/CouponHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@

/**
* Coupons History Model Class
*
* @property int $coupon_history_id
* @property int $coupon_id
* @property int|null $order_id
* @property int|null $customer_id
* @property string $code
* @property float|null $min_total
* @property float|null $amount
* @property \Illuminate\Support\Carbon $created_at
* @property bool $status
* @property \Illuminate\Support\Carbon $updated_at
* @property-read mixed $customer_name
* @mixin \Igniter\Flame\Database\Model
*/
class CouponHistory extends Model
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Models/CouponTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
]);

it('checks if coupon is expired', function($attributes) {
$this->travelTo(now()->weekday(3));
$this->travelTo(now()->setHour(12)->weekday(3));

$coupon = Coupon::factory()->create($attributes);

Expand Down

0 comments on commit e38cb0f

Please sign in to comment.