From 951753b90ae25a89ef64d44dcdf4cb44428911cc Mon Sep 17 00:00:00 2001 From: Ahmed Fathy Date: Wed, 29 Jan 2020 12:16:09 +0200 Subject: [PATCH 01/11] add support for laravel 6 --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 6b85992..988debd 100644 --- a/composer.json +++ b/composer.json @@ -15,9 +15,9 @@ "require": { "php": ">=5.5.9", "brozot/laravel-fcm": "~1.2.5", - "illuminate/notifications": "~5.3", - "illuminate/queue": "~5.1", - "illuminate/support": "~5.1" + "illuminate/notifications": "~5.3|6.*", + "illuminate/queue": "~5.1|6.*", + "illuminate/support": "~5.1|6.*" }, "require-dev": { "friendsofphp/php-cs-fixer": "~1.12.2", From 6547b7899247d991c64b004d11e4332d0d896e3d Mon Sep 17 00:00:00 2001 From: Ahmed Fathy Date: Wed, 29 Jan 2020 13:12:13 +0200 Subject: [PATCH 02/11] support auto discovery --- composer.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/composer.json b/composer.json index 988debd..e197549 100644 --- a/composer.json +++ b/composer.json @@ -41,6 +41,11 @@ "extra": { "branch-alias": { "dev-master": "1.0.x-dev" + }, + "laravel": { + "providers": [ + "NotificationChannels\\FCM\\ServiceProvider" + ] } }, "minimum-stability": "dev", From 7cab712bb761a2aa47a73bb71f303d37f205055b Mon Sep 17 00:00:00 2001 From: Ahmed Fathy Date: Wed, 29 Jan 2020 16:04:35 +0200 Subject: [PATCH 03/11] update phpunit & phpcs --- composer.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index e197549..7043858 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,8 @@ "illuminate/support": "~5.1|6.*" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~1.12.2", - "phpunit/phpunit": "4.*", + "friendsofphp/php-cs-fixer": "^2.15", + "phpunit/phpunit": "^7.5", "mockery/mockery": "^1.0" }, "autoload": { @@ -32,11 +32,10 @@ }, "scripts": { "test": [ - "@phpcs", "@phpunit" ], - "phpcs": "php vendor/bin/php-cs-fixer --diff --dry-run -v fix", - "phpunit": "php vendor/bin/phpunit" + "phpcs": "vendor/bin/php-cs-fixer fix", + "phpunit": "vendor/bin/phpunit" }, "extra": { "branch-alias": { From 3a4e6bd71c2bac82dc3141f15423fa9a20bfa599 Mon Sep 17 00:00:00 2001 From: Ahmed Fathy Date: Wed, 29 Jan 2020 16:05:35 +0200 Subject: [PATCH 04/11] use php 7.1 and upper --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7043858..e5369a2 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "email": "razumov.evgeni@gmail.com" }], "require": { - "php": ">=5.5.9", + "php": "^7.1.3", "brozot/laravel-fcm": "~1.2.5", "illuminate/notifications": "~5.3|6.*", "illuminate/queue": "~5.1|6.*", From 93b761630c833f7582204bdddd7f5c00450c5eb1 Mon Sep 17 00:00:00 2001 From: Ahmed Fathy Date: Wed, 29 Jan 2020 16:06:31 +0200 Subject: [PATCH 05/11] upgrade roles to PSR2 --- .php_cs | 144 +++++++++++++++++++++++++++----------------------------- 1 file changed, 69 insertions(+), 75 deletions(-) diff --git a/.php_cs b/.php_cs index e8c5a2a..118e05c 100644 --- a/.php_cs +++ b/.php_cs @@ -1,77 +1,71 @@ notPath('vendor') + ->in(__DIR__) + ->name('*.php') + ->ignoreDotFiles(true) + ->ignoreVCS(true); -use Symfony\CS\Config\Config; -use Symfony\CS\FixerInterface; -use Symfony\CS\Finder\DefaultFinder; - -$fixers = [ - 'blankline_after_open_tag', - 'braces', - 'concat_without_spaces', - 'double_arrow_multiline_whitespaces', - 'duplicate_semicolon', - 'elseif', - 'empty_return', - 'encoding', - 'eof_ending', - 'extra_empty_lines', - 'function_call_space', - 'function_declaration', - 'include', - 'indentation', - 'join_function', - 'line_after_namespace', - 'linefeed', - 'list_commas', - 'logical_not_operators_with_successor_space', - 'lowercase_constants', - 'lowercase_keywords', - 'method_argument_space', - 'multiline_array_trailing_comma', - 'multiline_spaces_before_semicolon', - 'multiple_use', - 'namespace_no_leading_whitespace', - 'no_blank_lines_after_class_opening', - 'no_empty_lines_after_phpdocs', - 'object_operator', - 'operators_spaces', - 'parenthesis', - 'phpdoc_indent', - 'phpdoc_inline_tag', - 'phpdoc_no_access', - 'phpdoc_no_package', - 'phpdoc_scalar', - 'phpdoc_short_description', - 'phpdoc_to_comment', - 'phpdoc_trim', - 'phpdoc_type_to_var', - 'phpdoc_var_without_name', - 'remove_leading_slash_use', - 'remove_lines_between_uses', - 'return', - 'self_accessor', - 'short_array_syntax', - 'short_echo_tag', - 'short_tag', - 'single_array_no_trailing_comma', - 'single_blank_line_before_namespace', - 'single_line_after_imports', - 'single_quote', - 'spaces_before_semicolon', - 'spaces_cast', - 'standardize_not_equal', - 'ternary_spaces', - 'trailing_spaces', - 'trim_array_spaces', - 'unalign_equals', - 'unary_operators_spaces', - 'unused_use', - 'visibility', - 'whitespacy_lines', -]; - -return Config::create() - ->finder(DefaultFinder::create()->in(__DIR__)) - ->fixers($fixers) - ->level(FixerInterface::NONE_LEVEL) - ->setUsingCache(true); +return PhpCsFixer\Config::create() + ->setRules([ + '@PSR2' => true, + /* + * Arrays + */ + // PHP arrays should be declared using the short syntax [] not array(). + 'array_syntax' => ['syntax' => 'short'], + // In array declaration, there MUST be a whitespace after each comma. + 'whitespace_after_comma_in_array' => true, + // PHP multi-line arrays should have a trailing comma. + 'trailing_comma_in_multiline_array' => true, + /* + * Whitespaces + */ + // Ensure there is no code on the same line as the PHP open tag and it is followed by a blank line. + 'blank_line_after_opening_tag' => true, + // Methods must be separated with one blank line. + 'method_separation' => true, + // An empty line feed should precede a return statement. + 'blank_line_before_return' => true, + // Remove trailing whitespace at the end of blank lines. + 'no_whitespace_in_blank_line' => true, + // Logical NOT operators (!) should have one trailing whitespace. + 'not_operator_with_successor_space' => true, + // There should not be space before or after object T_OBJECT_OPERATOR ->. + 'object_operator_without_whitespace' => true, + // A single space should be between cast and variable. + 'cast_spaces' => true, + // There should be exactly one blank line before a namespace declaration. + 'single_blank_line_before_namespace' => true, + // Standardize spaces around ternary operator. + 'ternary_operator_spaces' => true, + /* + * PHPDocs + */ + // Docblocks should have the same indentation as the documented subject. + 'phpdoc_indent' => true, + // Annotations in phpdocs should be ordered so that param annotations come first, then throws annotations, then return annotations. + 'phpdoc_order' => true, + // The type of @return annotations of methods returning a reference to itself must be $this. + 'phpdoc_return_self_reference' => true, + // Phpdocs summary should end in either a full stop, exclamation mark, or question mark. + 'phpdoc_summary' => true, + // Docblocks should only be used on structural elements. + 'phpdoc_to_comment' => true, + // @package and @subpackage annotations should be omitted from phpdocs. + 'phpdoc_no_package' => true, + // @var and @type annotations should not contain the variable name. + 'phpdoc_var_without_name' => true, + // Scalar types should always be written in the same form. int not integer, bool not boolean, float not real or double. + 'phpdoc_scalar' => true, + /* + * Other + */ + // Single line comments should use double slashes // and not hash #. + 'hash_to_slash_comment' => true, + // Cast (boolean) and (integer) should be written as (bool) and (int), (double) and (real) as (float). + 'short_scalar_cast' => true, + // The import statements should be sorted by length. + 'ordered_imports' => ['sortAlgorithm' => 'length'], + ]) + ->setFinder($finder); From be3b0795c1e3d83956fead7d436967828c6997dd Mon Sep 17 00:00:00 2001 From: Ahmed Fathy Date: Wed, 29 Jan 2020 16:06:58 +0200 Subject: [PATCH 06/11] remove syntaxCheck option & formating --- phpunit.xml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 58e1a70..b88c77b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,14 +1,13 @@ + backupStaticAttributes="false" + bootstrap="vendor/autoload.php" + colors="true" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + processIsolation="false" + stopOnFailure="false"> From e35886dc7614a081b75762e75eff2b4b15689428 Mon Sep 17 00:00:00 2001 From: Ahmed Fathy Date: Wed, 29 Jan 2020 16:08:51 +0200 Subject: [PATCH 07/11] fix unit testing issues --- tests/FCMChannelTest.php | 15 ++++++++------- tests/FCMMessageTest.php | 9 +++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/FCMChannelTest.php b/tests/FCMChannelTest.php index 1e3a720..3879f1e 100644 --- a/tests/FCMChannelTest.php +++ b/tests/FCMChannelTest.php @@ -3,17 +3,18 @@ namespace NotificationChannels\FCM\Test; use Mockery; +use PHPUnit\Framework\TestCase; use LaravelFCM\Sender\FCMSender; -use Illuminate\Events\Dispatcher; use Illuminate\Notifications\Notifiable; use NotificationChannels\FCM\FCMChannel; use NotificationChannels\FCM\FCMMessage; use Illuminate\Notifications\Notification; +use Illuminate\Contracts\Events\Dispatcher; use LaravelFCM\Response\DownstreamResponse; use NotificationChannels\FCM\MessageWasSended; use NotificationChannels\FCM\Exceptions\CouldNotSendNotification; -class FCMChannelTest extends \PHPUnit_Framework_TestCase +class FCMChannelTest extends TestCase { public function setUp() { @@ -38,7 +39,7 @@ public function it_can_send_a_notification() $message->to($to); $args = $message->getArgs(); $this->sender->shouldReceive('sendTo')->with(...$args)->andReturn(Mockery::mock(DownstreamResponse::class)); - $this->events->shouldReceive('fire')->with(Mockery::type(MessageWasSended::class)); + $this->events->shouldReceive('dispatch')->with(Mockery::type(MessageWasSended::class)); $result = $this->channel->send($notifiable, $notification); $this->assertInstanceOf(DownstreamResponse::class, $result); } @@ -53,7 +54,7 @@ public function it_return_null_with_recipient_empty_array() $message->to($to); $args = $message->getArgs(); $this->sender->shouldNotReceive('sendTo'); - $this->events->shouldNotReceive('fire'); + $this->events->shouldNotReceive('dispatch'); $result = $this->channel->send($notifiable, $notification); $this->assertNull($result); } @@ -61,15 +62,15 @@ public function it_return_null_with_recipient_empty_array() /** @test */ public function it_throw_could_not_send_notification_exception() { - $this->setExpectedException(CouldNotSendNotification::class); + $this->expectException(CouldNotSendNotification::class); $notifiable = new TestNotifiableWithInvalidRecipient; $notification = new TestNotification; try { $this->channel->send($notifiable, $notification); } catch (CouldNotSendNotification $e) { $this->assertEquals( - 'Notification was not sent. You should specify device token(s), topic(s) or group(s) for sending notification.', - $e->getMessage() + 'Notification was not sent. You should specify device token(s), topic(s) or group(s) for sending notification.', + $e->getMessage() ); throw $e; } diff --git a/tests/FCMMessageTest.php b/tests/FCMMessageTest.php index a42cf99..a23704a 100644 --- a/tests/FCMMessageTest.php +++ b/tests/FCMMessageTest.php @@ -3,6 +3,7 @@ namespace NotificationChannels\FCM\Test; use LaravelFCM\Message\Options; +use PHPUnit\Framework\TestCase; use LaravelFCM\Message\PayloadData; use LaravelFCM\Message\OptionsBuilder; use NotificationChannels\FCM\FCMMessage; @@ -12,7 +13,7 @@ use LaravelFCM\Message\PayloadNotificationBuilder; use NotificationChannels\FCM\Exceptions\InvalidArgumentException; -class FCMMessageTest extends \PHPUnit_Framework_TestCase +class FCMMessageTest extends TestCase { /** @test */ public function it_construct_with_options_from_builder() @@ -115,7 +116,7 @@ public function it_construct_with_options_merge_if_array() /** @test */ public function it_construct_with_options_and_throw_exception() { - $this->setExpectedException(InvalidArgumentException::class); + $this->expectException(InvalidArgumentException::class); try { (new FCMMessage())->options('foo'); } catch (InvalidArgumentException $e) { @@ -206,7 +207,7 @@ public function it_construct_with_data_merge_if_array() /** @test */ public function it_construct_with_data_and_throw_exception() { - $this->setExpectedException(InvalidArgumentException::class); + $this->expectException(InvalidArgumentException::class); try { (new FCMMessage())->data('foo'); } catch (InvalidArgumentException $e) { @@ -350,7 +351,7 @@ public function it_construct_with_notification_merge_if_array() /** @test */ public function it_construct_with_notification_and_throw_exception() { - $this->setExpectedException(InvalidArgumentException::class); + $this->expectException(InvalidArgumentException::class); try { (new FCMMessage())->notification('foo'); } catch (InvalidArgumentException $e) { From 6c9452c4e5a0b3313b4c9618314d1802ee1e164f Mon Sep 17 00:00:00 2001 From: Ahmed Fathy Date: Wed, 29 Jan 2020 16:11:33 +0200 Subject: [PATCH 08/11] formating --- src/FCMChannel.php | 9 +++++---- src/FCMMessage.php | 17 ++++++++--------- src/FCMMessageTopic.php | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/FCMChannel.php b/src/FCMChannel.php index b8000cf..4b69f81 100644 --- a/src/FCMChannel.php +++ b/src/FCMChannel.php @@ -3,7 +3,7 @@ namespace NotificationChannels\FCM; use LaravelFCM\Sender\FCMSender; -use Illuminate\Events\Dispatcher; +use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Notifications\Notification; use NotificationChannels\FCM\Exceptions\CouldNotSendNotification; @@ -15,14 +15,15 @@ class FCMChannel protected $sender; /** - * @var \Illuminate\Events\Dispatcher + * @var \Illuminate\Contracts\Events\Dispatcher */ protected $events; /** * Constructor. * - * @param \LaravelFCM\Sender\FCMSender $sender + * @param \LaravelFCM\Sender\FCMSender $sender + * @param \Illuminate\Contracts\Events\Dispatcher $events */ public function __construct(FCMSender $sender, Dispatcher $events) { @@ -62,7 +63,7 @@ public function send($notifiable, Notification $notification) $response = $this->sender->{$method}(...$message->getArgs()); - $this->events->fire(new MessageWasSended($response, $notifiable)); + $this->events->dispatch(new MessageWasSended($response, $notifiable)); return $response; } diff --git a/src/FCMMessage.php b/src/FCMMessage.php index c011f06..9933cff 100644 --- a/src/FCMMessage.php +++ b/src/FCMMessage.php @@ -150,11 +150,9 @@ public function __construct($options = null, $notification = null, $data = null) /** * Call method. * - * @param string $method - * @param mixed $value - * + * @param string $method + * @param array $arguments * @return mixed - * @throws \BadMethodCallException */ public function __call($method, array $arguments) { @@ -196,9 +194,10 @@ public function __call($method, array $arguments) /** * Create Message. * - * @param mixed $options - * @param mixed $notification - * @param mixed $data + * @param mixed $options + * @param mixed $notification + * @param mixed $data + * @return \NotificationChannels\FCM\FCMMessage */ public static function create($options = null, $notification = null, $data = null) { @@ -244,7 +243,7 @@ protected static function makeInvalidArgumentException($data, $method, $containe } return new InvalidArgumentException( - 'The argument for %s::%s must be instanceof %s, %s, null or array. %s given.', + 'The argument for %s::%s must be instanceof %s, %s, null or array. %s given.', [ self::class, $method, $container, $builder, $type, ] @@ -273,7 +272,7 @@ protected static function populateBuilder($builder, array $map, array $data) * Set Options. * * @param mixed $options - * @return + * @return $this */ public function options($options = null) { diff --git a/src/FCMMessageTopic.php b/src/FCMMessageTopic.php index 89fdfed..1ba4d39 100644 --- a/src/FCMMessageTopic.php +++ b/src/FCMMessageTopic.php @@ -19,7 +19,7 @@ public function to($recipient) } return new InvalidArgumentException( - 'The argument for %s::%s must be instanceof %s, null or array. %s given.', + 'The argument for %s::%s must be instanceof %s, null or array. %s given.', [ self::class, 'to', Topics::class, $type, ] From de7a19953825682f3b494b4b968d3f5cbffb68b0 Mon Sep 17 00:00:00 2001 From: Ahmed Fathy Date: Wed, 29 Jan 2020 16:25:05 +0200 Subject: [PATCH 09/11] update readme.md --- README.md | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f82e71d..2839e65 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# FCM notification channel for Laravel 5.3 +# FCM notification channel for Laravel 6.x This package makes it easy to send notifications using [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging/) (FCM) with Laravel 5.3. This package is based on [brozot/laravel-fcm](https://github.com/brozot/Laravel-FCM), so please read that documentation for more information. @@ -17,20 +17,37 @@ This package is based on [brozot/laravel-fcm](https://github.com/brozot/Laravel- ## Installation -You can install this package via composer: +Before installation you should to add the following code to your `composer.json` file : +``` +"repositories": [ + { + "type": "vcs", + "url": "https://github.com/ahmed-aliraqi/laravel-fcm-notification-channel" + } +], +``` + +Now you can install this package via composer: ``` bash -composer require enniel/laravel-fcm-notification-channel:1.* +composer require enniel/laravel-fcm-notification-channel ``` -Register the provider directly in your app configuration file `config/app.php`: -``` php -'providers' => [ - // ... - NotificationChannels\FCM\ServiceProvider::class -] +## Package Configuration + +In your `.env` file, add the server key and the secret key for the Firebase Cloud Messaging: + +```dotenv +FCM_SERVER_KEY=my_secret_server_key +FCM_SENDER_ID=my_secret_sender_id ``` +To get these keys, you must create a new application on the [firebase cloud messaging console](https://console.firebase.google.com/). + +After the creation of your application on Firebase, you can find keys in `project settings -> cloud messaging`. + + + ## Usage Now you can use the channel in your `via()` method inside the notification: @@ -49,7 +66,7 @@ class ExampleNotification extends Notification public function toFCM($notifiable) { return (new FCMMessage()) - ->notification([ + ->data([ 'title' => 'Notification title', 'body' => 'Notification body', ]); From c0adc7075c36d94ba0ef53195b743cc96513e703 Mon Sep 17 00:00:00 2001 From: Ahmed Fathy Date: Wed, 29 Jan 2020 16:26:47 +0200 Subject: [PATCH 10/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2839e65..0cf789a 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This package is based on [brozot/laravel-fcm](https://github.com/brozot/Laravel- ## Installation -Before installation you should to add the following code to your `composer.json` file : +Before installation you should to add this repository to your `composer.json` file : ``` "repositories": [ { From 1123e0835625051abc1a98886fa85fe680f30590 Mon Sep 17 00:00:00 2001 From: Pau Benet Prat Date: Fri, 24 Apr 2020 11:40:22 +0200 Subject: [PATCH 11/11] update composer to support laravel 7 --- .idea/.gitignore | 8 ++ .idea/inspectionProfiles/Project_Default.xml | 9 ++ .idea/laravel-fcm-notification-channel.iml | 103 ++++++++++++++++++ .idea/misc.xml | 6 + .idea/modules.xml | 8 ++ .idea/php.xml | 109 +++++++++++++++++++ .idea/phpunit.xml | 10 ++ .idea/vcs.xml | 6 + composer.json | 14 +-- src/FCMChannel.php | 2 +- src/FCMMessage.php | 2 +- tests/FCMChannelTest.php | 18 +-- tests/FCMMessageTest.php | 6 +- 13 files changed, 280 insertions(+), 21 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/laravel-fcm-notification-channel.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/php.xml create mode 100644 .idea/phpunit.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..73f69e0 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..e3d68ca --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/.idea/laravel-fcm-notification-channel.iml b/.idea/laravel-fcm-notification-channel.iml new file mode 100644 index 0000000..0af378f --- /dev/null +++ b/.idea/laravel-fcm-notification-channel.iml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..6a6d442 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..00b0c8b --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/phpunit.xml b/.idea/phpunit.xml new file mode 100644 index 0000000..4f8104c --- /dev/null +++ b/.idea/phpunit.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/composer.json b/composer.json index e5369a2..53e83d0 100644 --- a/composer.json +++ b/composer.json @@ -14,15 +14,15 @@ }], "require": { "php": "^7.1.3", - "brozot/laravel-fcm": "~1.2.5", - "illuminate/notifications": "~5.3|6.*", - "illuminate/queue": "~5.1|6.*", - "illuminate/support": "~5.1|6.*" + "apility/laravel-fcm": "^1.4", + "illuminate/notifications": "^7.7", + "illuminate/support": "^7.7", + "illuminate/queue": "^7.7" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.15", - "phpunit/phpunit": "^7.5", - "mockery/mockery": "^1.0" + "phpunit/phpunit": "^9.1", + "mockery/mockery": "^1.3", + "friendsofphp/php-cs-fixer": "^2.16" }, "autoload": { "psr-4": { diff --git a/src/FCMChannel.php b/src/FCMChannel.php index 4b69f81..18e0019 100644 --- a/src/FCMChannel.php +++ b/src/FCMChannel.php @@ -2,9 +2,9 @@ namespace NotificationChannels\FCM; -use LaravelFCM\Sender\FCMSender; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Notifications\Notification; +use LaravelFCM\Sender\FCMSender; use NotificationChannels\FCM\Exceptions\CouldNotSendNotification; class FCMChannel diff --git a/src/FCMMessage.php b/src/FCMMessage.php index 9933cff..dab82dd 100644 --- a/src/FCMMessage.php +++ b/src/FCMMessage.php @@ -4,9 +4,9 @@ use Illuminate\Support\Arr; use LaravelFCM\Message\Options; -use LaravelFCM\Message\PayloadData; use LaravelFCM\Message\OptionsBuilder; use LaravelFCM\Message\OptionsPriorities; +use LaravelFCM\Message\PayloadData; use LaravelFCM\Message\PayloadDataBuilder; use LaravelFCM\Message\PayloadNotification; use LaravelFCM\Message\PayloadNotificationBuilder; diff --git a/tests/FCMChannelTest.php b/tests/FCMChannelTest.php index 3879f1e..85d9895 100644 --- a/tests/FCMChannelTest.php +++ b/tests/FCMChannelTest.php @@ -2,28 +2,28 @@ namespace NotificationChannels\FCM\Test; -use Mockery; -use PHPUnit\Framework\TestCase; -use LaravelFCM\Sender\FCMSender; +use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Notifications\Notifiable; -use NotificationChannels\FCM\FCMChannel; -use NotificationChannels\FCM\FCMMessage; use Illuminate\Notifications\Notification; -use Illuminate\Contracts\Events\Dispatcher; use LaravelFCM\Response\DownstreamResponse; -use NotificationChannels\FCM\MessageWasSended; +use LaravelFCM\Sender\FCMSender; +use Mockery; use NotificationChannels\FCM\Exceptions\CouldNotSendNotification; +use NotificationChannels\FCM\FCMChannel; +use NotificationChannels\FCM\FCMMessage; +use NotificationChannels\FCM\MessageWasSended; +use PHPUnit\Framework\TestCase; class FCMChannelTest extends TestCase { - public function setUp() + public function setUp(): void { $this->sender = Mockery::mock(FCMSender::class); $this->events = Mockery::mock(Dispatcher::class); $this->channel = new FCMChannel($this->sender, $this->events); } - public function tearDown() + public function tearDown(): void { Mockery::close(); parent::tearDown(); diff --git a/tests/FCMMessageTest.php b/tests/FCMMessageTest.php index a23704a..6868aa3 100644 --- a/tests/FCMMessageTest.php +++ b/tests/FCMMessageTest.php @@ -3,15 +3,15 @@ namespace NotificationChannels\FCM\Test; use LaravelFCM\Message\Options; -use PHPUnit\Framework\TestCase; -use LaravelFCM\Message\PayloadData; use LaravelFCM\Message\OptionsBuilder; -use NotificationChannels\FCM\FCMMessage; use LaravelFCM\Message\OptionsPriorities; +use LaravelFCM\Message\PayloadData; use LaravelFCM\Message\PayloadDataBuilder; use LaravelFCM\Message\PayloadNotification; use LaravelFCM\Message\PayloadNotificationBuilder; use NotificationChannels\FCM\Exceptions\InvalidArgumentException; +use NotificationChannels\FCM\FCMMessage; +use PHPUnit\Framework\TestCase; class FCMMessageTest extends TestCase {