Skip to content

Commit

Permalink
Laravel 10 Support
Browse files Browse the repository at this point in the history
  • Loading branch information
clnt committed May 1, 2023
1 parent 818b3fc commit aec55d3
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 49 deletions.
10 changes: 4 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
vendor/
node_modules/

# Laravel 4 specific
.idea
bootstrap/compiled.php
app/storage/

# Laravel 5 & Lumen specific
bootstrap/cache/
.env.*.php
.env.php
.env

*.DS_Store
*.DS_Store
.phpunit.result.cache
composer.lock
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [5.0.0] - 01-05-2023
### Changed
- Laravel 10 compatibility
- Remove old travis config and replace with GH actions
## [4.0.1] - 14-02-2022
### Changed
- Laravel 9 compatibility
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
],
"minimum-stability": "dev",
"require": {
"php": "^7.3|^8.0",
"illuminate/support": "^5.5|^6.0|^7.0|^8.0|^9.0",
"illuminate/database": "^5.5|^6.0|^7.0|^8.0|^9.0",
"illuminate/contracts": "^5.5|^6.0|^7.0|^8.0|^9.0",
"illuminate/session": "^5.5|^6.0|^7.0|^8.0|^9.0"
"php": "^8.0",
"illuminate/support": "^10.0",
"illuminate/database": "^10.0",
"illuminate/contracts": "^10.0",
"illuminate/session": "^10.0"
},
"require-dev": {
"mockery/mockery": "^1.0",
"orchestra/testbench": "^3.4|^4.0|^5.0|^6.0|^7.0",
"phpunit/phpunit": "^6.0|^7.0|^8.0|^9.0"
"orchestra/testbench": "^8.0",
"phpunit/phpunit": "^9.0"
},
"autoload": {
"psr-4": {
Expand Down
68 changes: 32 additions & 36 deletions tests/ToasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
use Illuminate\Support\Facades\Config;
use Laralabs\Toaster\Toaster;
use Laralabs\Toaster\ToasterGroup;
use Session;
use Illuminate\Support\Facades\Session;

class ToasterTest extends TestCase
{
/** @test */
public function toaster_function_returns_toaster_instance()
public function toaster_function_returns_toaster_instance(): void
{
$toaster = toaster();

$this->assertInstanceOf(Toaster::class, $toaster);
}

/** @test */
public function it_displays_default_toast_and_can_clear_all()
public function it_displays_default_toast_and_can_clear_all(): void
{
$this->toaster->add('cheese');

Expand Down Expand Up @@ -62,7 +62,7 @@ public function it_displays_default_toast_and_can_clear_all()
}

/** @test */
public function it_can_create_a_toaster_group_and_set_name()
public function it_can_create_a_toaster_group_and_set_name(): void
{
$this->toaster->group('toastie');

Expand All @@ -75,7 +75,7 @@ public function it_can_create_a_toaster_group_and_set_name()
}

/** @test */
public function it_can_create_a_toaster_group_and_set_properties()
public function it_can_create_a_toaster_group_and_set_properties(): void
{
$properties = [
'name' => 'toastie',
Expand All @@ -101,7 +101,7 @@ public function it_can_create_a_toaster_group_and_set_properties()
}

/** @test */
public function it_can_update_existing_group_properties()
public function it_can_update_existing_group_properties(): void
{
$properties = [
'name' => 'toastie',
Expand All @@ -128,7 +128,7 @@ public function it_can_update_existing_group_properties()
}

/** @test */
public function it_can_set_group_width()
public function it_can_set_group_width(): void
{
$this->toaster->group('toastie')->width('100%');

Expand All @@ -142,7 +142,7 @@ public function it_can_set_group_width()
}

/** @test */
public function it_can_set_group_classes()
public function it_can_set_group_classes(): void
{
$this->toaster->group('toastie')->classes(['salt', 'pepper']);

Expand All @@ -156,7 +156,7 @@ public function it_can_set_group_classes()
}

/** @test */
public function it_can_set_group_position()
public function it_can_set_group_position(): void
{
$this->toaster->group('toastie')->position('top left');

Expand All @@ -170,7 +170,7 @@ public function it_can_set_group_position()
}

/** @test */
public function it_can_set_group_max_toasts()
public function it_can_set_group_max_toasts(): void
{
$this->toaster->group('toastie')->max(10);

Expand All @@ -184,7 +184,7 @@ public function it_can_set_group_max_toasts()
}

/** @test */
public function it_can_set_group_reverse_order()
public function it_can_set_group_reverse_order(): void
{
$this->toaster->group('toastie')->reverse(true);

Expand All @@ -198,7 +198,7 @@ public function it_can_set_group_reverse_order()
}

/** @test */
public function it_can_mass_update_last_toast_properties()
public function it_can_mass_update_last_toast_properties(): void
{
$properties = [
'group' => 'toastie',
Expand Down Expand Up @@ -227,7 +227,7 @@ public function it_can_mass_update_last_toast_properties()
}

/** @test */
public function it_can_add_toast_with_properties()
public function it_can_add_toast_with_properties(): void
{
$properties = [
'group' => 'toastie',
Expand Down Expand Up @@ -255,7 +255,7 @@ public function it_can_add_toast_with_properties()
}

/** @test */
public function it_can_add_toast_to_specified_group()
public function it_can_add_toast_to_specified_group(): void
{
$properties = [
'group' => 'toastie',
Expand Down Expand Up @@ -285,7 +285,7 @@ public function it_can_add_toast_to_specified_group()
}

/** @test */
public function it_throws_exception_for_invalid_group()
public function it_throws_exception_for_invalid_group(): void
{
$this->expectExceptionMessage('No group found with the specified name');

Expand All @@ -307,7 +307,7 @@ public function it_throws_exception_for_invalid_group()
}

/** @test */
public function it_can_stagger_groups()
public function it_can_stagger_groups(): void
{
Config::set('toaster.toast_stagger_all', false);

Expand All @@ -329,7 +329,7 @@ public function it_can_stagger_groups()
}

/** @test */
public function it_can_stagger_all_groups_and_retain_custom_duration()
public function it_can_stagger_all_groups_and_retain_custom_duration(): void
{
Config::set('toaster.toast_stagger_all', true);

Expand All @@ -352,7 +352,7 @@ public function it_can_stagger_all_groups_and_retain_custom_duration()
}

/** @test */
public function it_displays_multiple_toast()
public function it_displays_multiple_toast(): void
{
$this->toaster->group('toastie')
->add('ham')
Expand All @@ -364,7 +364,7 @@ public function it_displays_multiple_toast()
}

/** @test */
public function it_sets_default_duration_and_speed()
public function it_sets_default_duration_and_speed(): void
{
$this->toaster->group('toastie')->add('cheese');

Expand All @@ -379,7 +379,7 @@ public function it_sets_default_duration_and_speed()
}

/** @test */
public function it_sets_custom_duration_and_speed()
public function it_sets_custom_duration_and_speed(): void
{
$this->toaster->group('toastie')->add('cheese')->duration(5000)->speed(800);

Expand All @@ -396,7 +396,7 @@ public function it_sets_custom_duration_and_speed()
}

/** @test */
public function it_sets_info_toast()
public function it_sets_info_toast(): void
{
$this->toaster->group('toastie')->add('cheese')->info();

Expand All @@ -411,7 +411,7 @@ public function it_sets_info_toast()
}

/** @test */
public function it_sets_success_toast()
public function it_sets_success_toast(): void
{
$this->toaster->group('toastie')->add('cheese')->success();

Expand All @@ -426,7 +426,7 @@ public function it_sets_success_toast()
}

/** @test */
public function it_sets_warning_toast()
public function it_sets_warning_toast(): void
{
$this->toaster->group('toastie')->add('cheese')->warning();

Expand All @@ -441,7 +441,7 @@ public function it_sets_warning_toast()
}

/** @test */
public function it_sets_error_toast()
public function it_sets_error_toast(): void
{
$this->toaster->group('toastie')->add('cheese')->error();

Expand All @@ -456,7 +456,7 @@ public function it_sets_error_toast()
}

/** @test */
public function it_sets_important_toast()
public function it_sets_important_toast(): void
{
$this->toaster->group('toastie')->add('cheese')->important();

Expand All @@ -472,7 +472,7 @@ public function it_sets_important_toast()
}

/** @test */
public function it_sets_toast_title()
public function it_sets_toast_title(): void
{
$this->toaster->group('toastie')->add('cheese')->title('Toastie Ingredients');

Expand All @@ -488,7 +488,7 @@ public function it_sets_toast_title()
}

/** @test */
public function it_generates_correctly_structured_json()
public function it_generates_correctly_structured_json(): void
{
$this->toaster->group('toastie')->add('ham')->success()->add('cheese');

Expand All @@ -500,7 +500,7 @@ public function it_generates_correctly_structured_json()
}

/** @test */
public function it_generates_correct_component_html()
public function it_generates_correct_component_html(): void
{
$this->toaster->group('toastie')->add('ham')->success()->add('cheese');

Expand All @@ -510,26 +510,22 @@ public function it_generates_correct_component_html()
}

/** @test */
public function it_has_mandatory_message_argument()
public function it_has_mandatory_message_argument(): void
{
if (version_compare(PHP_VERSION, '7.1', '>=')) {
$this->expectException('ArgumentCountError');
} else {
$this->expectException('ErrorException');
}
$this->expectException('ArgumentCountError');

$this->toaster->add();
}

/** @test */
public function it_aborts_editing_non_message()
public function it_aborts_editing_non_message(): void
{
$this->expectExceptionMessage('Use the add() function to add a message before attempting to modify it');

$this->toaster->group('toastie')->success();
}

protected function assertSessionHas($name, $value = null)
protected function assertSessionHas($name, $value = null): void
{
$this->assertTrue(Session::has($name), "Session doesn't contain '$name'");
if ($value) {
Expand Down

0 comments on commit aec55d3

Please sign in to comment.