Skip to content

Commit

Permalink
Merge pull request #16 from mohammedmanssour/laravel-11
Browse files Browse the repository at this point in the history
upgrade to laravel 11
  • Loading branch information
mohammedmanssour authored May 10, 2024
2 parents 293ec10 + 3096352 commit 89c6d52
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 31 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
"require": {
"php": "^8.1",
"spatie/laravel-package-tools": "^1.14.0",
"illuminate/contracts": "^10.0"
"illuminate/contracts": "^11.1"
},
"require-dev": {
"larastan/larastan": "^2.9",
"laravel/pint": "^1.0",
"nunomaduro/collision": "^7.9",
"orchestra/testbench": "^8.0",
"nunomaduro/collision": "^8.1",
"orchestra/testbench": "^9.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0"
Expand Down
27 changes: 13 additions & 14 deletions tests/RepeatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
use MohammedManssour\LaravelRecurringModels\Exceptions\RepetitionEndsAfterNotAvailableException;
use MohammedManssour\LaravelRecurringModels\Tests\Stubs\Support\HasTask;
use MohammedManssour\LaravelRecurringModels\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class RepeatTest extends TestCase
{
use HasTask;

/** @test */
#[Test]
public function it_creates_daily_repetition_for_task_with_no_end()
{
$this->task()
Expand All @@ -24,7 +25,7 @@ public function it_creates_daily_repetition_for_task_with_no_end()
]);
}

/** @test */
#[Test]
public function it_creates_daily_repetition_for_task_that_ends_in_a_specific_date()
{
$this->task()
Expand All @@ -39,7 +40,7 @@ public function it_creates_daily_repetition_for_task_that_ends_in_a_specific_dat
]);
}

/** @test */
#[Test]
public function it_can_create_daily_repetition_for_task_that_ends_after_n_times()
{
$this->task()
Expand All @@ -54,7 +55,7 @@ public function it_can_create_daily_repetition_for_task_that_ends_after_n_times(
]);
}

/** @test */
#[Test]
public function it_create_daily_repetition()
{
$this->task()
Expand All @@ -68,7 +69,7 @@ public function it_create_daily_repetition()
]);
}

/** @test */
#[Test]
public function it_creates_daily_repetition_with_timezone()
{
Carbon::setTestNowAndTimezone(
Expand All @@ -88,7 +89,7 @@ public function it_creates_daily_repetition_with_timezone()
]);
}

/** @test */
#[Test]
public function it_creates_weekly_repetition()
{
$this->task()
Expand All @@ -105,7 +106,7 @@ public function it_creates_weekly_repetition()
]);
}

/** @test */
#[Test]
public function it_creates_weekly_repetition_for_task_that_occrres_on_specific_days()
{
$days = ['sunday', 'tuesday', 'thursday'];
Expand All @@ -126,7 +127,7 @@ public function it_creates_weekly_repetition_for_task_that_occrres_on_specific_d
}
}

/** @test */
#[Test]
public function it_creates_weekly_repetition_with_timezone()
{
Carbon::setTestNowAndTimezone(
Expand All @@ -149,7 +150,7 @@ public function it_creates_weekly_repetition_with_timezone()
]);
}

/** @test */
#[Test]
public function it_creates_complex_repetition_patterns_for_task()
{
$this->task()
Expand All @@ -169,7 +170,7 @@ public function it_creates_complex_repetition_patterns_for_task()
]);
}

/** @test */
#[Test]
public function it_sets_start_date_explicitly()
{
$this->task()
Expand All @@ -182,7 +183,7 @@ public function it_sets_start_date_explicitly()
]);
}

/** @test */
#[Test]
public function it_throws_an_exception_when_using_endsAfter_with_complex_repeitions()
{
$this->expectException(RepetitionEndsAfterNotAvailableException::class);
Expand All @@ -194,9 +195,7 @@ public function it_throws_an_exception_when_using_endsAfter_with_complex_repeiti
->endsAfter(3);
}

/**
* @test
* */
#[Test]
public function it_creates_complex_repetition_with_timezone()
{
Carbon::setTestNowAndTimezone(
Expand Down
5 changes: 3 additions & 2 deletions tests/RepeatableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
use MohammedManssour\LaravelRecurringModels\Tests\Stubs\Models\Task;
use MohammedManssour\LaravelRecurringModels\Tests\Stubs\Support\HasTask;
use MohammedManssour\LaravelRecurringModels\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class RepeatableTest extends TestCase
{
use HasTask;

/** @test */
#[Test]
public function it_gets_the_repeatable_model_that_will_occure_in_a_specific_date()
{
$this->repetition($this->task(), '2023-04-23 00:00:00');
Expand All @@ -22,7 +23,7 @@ public function it_gets_the_repeatable_model_that_will_occure_in_a_specific_date
$this->assertNull($model);
}

/** @test */
#[Test]
public function it_gets_the_repeatable_model_that_will_occure_between_specific_dates()
{
$this->repetition($this->task(), '2023-04-23 00:00:00');
Expand Down
23 changes: 11 additions & 12 deletions tests/RepetitionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
use MohammedManssour\LaravelRecurringModels\Models\Repetition;
use MohammedManssour\LaravelRecurringModels\Tests\Stubs\Support\HasTask;
use MohammedManssour\LaravelRecurringModels\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class RepetitionTest extends TestCase
{
use HasTask;

/**
* @test
* */
#[Test]
public function it_checks_if_recurring_is_active_for_the_date()
{
// repeat start at 2023-04-15 00:00:00 and ends at 2023-04-15
Expand All @@ -29,7 +28,7 @@ public function it_checks_if_recurring_is_active_for_the_date()
}
}

/** @test */
#[Test]
public function it_checks_if_simple_repetition_occurres_on_specific_day()
{
// repeat start at 2023-04-15 00:00:00
Expand Down Expand Up @@ -67,7 +66,7 @@ public function it_checks_if_simple_repetition_occurres_on_specific_day()
$this->assertNull(Repetition::whereHasComplexRecurringOn($date)->first());
}

/** @test */
#[Test]
public function it_checks_if_simple_repetition_occurres_on_specific_day_with_timezone()
{
Carbon::setTestNowAndTimezone(
Expand All @@ -89,7 +88,7 @@ public function it_checks_if_simple_repetition_occurres_on_specific_day_with_tim
$this->assertNull($model);
}

/** @test */
#[Test]
public function it_checks_if_simple_repetition_occurres_on_specific_dates_after_end_date()
{
$this->repetition($this->task(), '2023-04-23 00:00:00');
Expand All @@ -98,7 +97,7 @@ public function it_checks_if_simple_repetition_occurres_on_specific_dates_after_
$this->assertNull($model);
}

/** @test */
#[Test]
public function it_checks_if_simple_repetition_occurres_between_two_specific_dates()
{
// repeat start at 2023-04-15 00:00:00
Expand All @@ -119,7 +118,7 @@ public function it_checks_if_simple_repetition_occurres_between_two_specific_dat
);
}

/** @test */
#[Test]
public function it_checks_if_complex_repetition_occurres_on_specific_dates()
{
Carbon::setTestNow(
Expand Down Expand Up @@ -149,7 +148,7 @@ public function it_checks_if_complex_repetition_occurres_on_specific_dates()
$this->assertNull(Repetition::whereOccurresOn(Carbon::make('2023-05-19'))->first());
}

/** @test */
#[Test]
public function it_checks_if_complex_repetition_occurres_on_specific_dates_with_timezone()
{
Carbon::setTestNowAndTimezone(
Expand Down Expand Up @@ -182,7 +181,7 @@ public function it_checks_if_complex_repetition_occurres_on_specific_dates_with_
$this->assertNull(Repetition::whereOccurresOn(Carbon::make('2023-05-19'))->first());
}

/** @test */
#[Test]
public function it_returns_correct_period()
{
// repeat start at 2023-04-15 00:00:00
Expand All @@ -196,7 +195,7 @@ public function it_returns_correct_period()
}
}

/** @test */
#[Test]
public function it_returns_correct_next_simple_repetition()
{
// repeat start at 2023-04-15 00:00:00
Expand All @@ -207,7 +206,7 @@ public function it_returns_correct_next_simple_repetition()
$this->assertEquals(null, $repetition->nextOccurrence(Carbon::make('2023-04-30')));
}

/** @test */
#[Test]
public function it_returns_correct_next_complex_repetition()
{
Carbon::setTestNow(
Expand Down

0 comments on commit 89c6d52

Please sign in to comment.