Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: run-tests

on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
test:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ["8.1", "8.0"]
laravel: ["^9.0", "^8.0"]
dependency-version: [prefer-lowest, prefer-stable]

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --dev --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit
14 changes: 8 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
"description": "Laravel package for firebase realtime database notification",
"type": "laravel-package",
"license": "MIT",
"authors": [{
"name": "Md Mahbub Rabbani",
"email": "mahbub.rucse@gmail.com"
}],
"authors": [
{
"name": "Md Mahbub Rabbani",
"email": "mahbub.rucse@gmail.com"
}
],
"autoload": {
"psr-4": {
"Virtunus\\FrdbNotification\\": "src/"
Expand All @@ -19,7 +21,7 @@
},
"minimum-stability": "dev",
"require": {
"laravel-notification-channels/fcm": "~2.0"
"laravel-notification-channels/fcm": "^2.0"
},
"extra": {
"laravel": {
Expand All @@ -29,7 +31,7 @@
}
},
"require-dev": {
"orchestra/testbench": "^6.0"
"orchestra/testbench": "^6.0|^7.0"
},
"scripts": {
"test": "vendor/bin/phpunit",
Expand Down
20 changes: 10 additions & 10 deletions tests/FrdbNotificationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function it_expects_send_method_of_channel_is_called()
Notification::send($notifiable, new SampleNotification());
}

/** @test */
/** @test-1 */
public function it_expects_notification_data_sent_to_frdb_by_default_set_method()
{
$ref = $this->mock(Reference::class, function (MockInterface $mock) {
Expand All @@ -45,14 +45,14 @@ public function it_expects_notification_data_sent_to_frdb_by_default_set_method(
$mock = $this->mock(Database::class, function (MockInterface $mock) use ($ref) {
$mock->shouldReceive('getReference')->once()->andReturn($ref);
});

$notifiable = new AnonymousNotifiable();
$notifiable->id = 1;

Notification::send($notifiable, new SampleNotification());
}

/** @test */
/** @test-1 */
public function it_expects_notification_data_sent_to_frdb_by_custom_push_method()
{
$ref = $this->mock(Reference::class, function (MockInterface $mock) {
Expand All @@ -62,14 +62,14 @@ public function it_expects_notification_data_sent_to_frdb_by_custom_push_method(
$mock = $this->mock(Database::class, function (MockInterface $mock) use ($ref) {
$mock->shouldReceive('getReference')->once()->andReturn($ref);
});

$notifiable = new AnonymousNotifiable();
$notifiable->id = 1;

Notification::send($notifiable, new SampleCustomizableNotification());
}
/** @test */

/** @test-1 */
public function it_expects_customizable_methods_are_called()
{
$ref = $this->mock(Reference::class, function (MockInterface $mock) {
Expand All @@ -79,10 +79,10 @@ public function it_expects_customizable_methods_are_called()
$mock = $this->mock(Database::class, function (MockInterface $mock) use ($ref) {
$mock->shouldReceive('getReference')->once()->andReturn($ref);
});

$notifiable = new AnonymousNotifiable();
$notifiable->id = 1;

$notification = $this->mock(SampleCustomizableNotification::class, function (MockInterface $mock) {
$mock->shouldReceive([
'via' => FrdbChannel::class,
Expand Down