Skip to content
Merged
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
74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
tests:
name: Tests (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- php: '7.4'
symfony: '5.4.*'
phpunit: '^9.6'
- php: '8.1'
symfony: '5.4.*'
- php: '8.1'
symfony: '6.4.*'
- php: '8.2'
symfony: '6.4.*'
- php: '8.2'
symfony: '7.2.*'
- php: '8.3'
symfony: '7.2.*'

steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Lock Symfony version
run: |
composer require --no-update \
symfony/config:"${{ matrix.symfony }}" \
symfony/dependency-injection:"${{ matrix.symfony }}" \
symfony/http-kernel:"${{ matrix.symfony }}" \
symfony/yaml:"${{ matrix.symfony }}"

- name: Lock PHPUnit version
if: matrix.phpunit
run: composer require --dev --no-update phpunit/phpunit:"${{ matrix.phpunit }}"

- name: Install dependencies
run: composer update --prefer-dist --no-progress

- name: Run tests
run: vendor/bin/phpunit

phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run PHPStan
run: vendor/bin/phpstan analyse
2 changes: 1 addition & 1 deletion .phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":2,"defects":{"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\RedjanYmFCMExtensionTest::testLoadRegistersServicesAndParameters":8,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\RedjanYmFCMExtensionTest::testClientServiceIsPublic":8,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\RedjanYmFCMExtensionTest::testNotificationFactoryServiceIsPublic":8},"times":{"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\ConfigurationTest::testValidConfiguration":0.004,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\ConfigurationTest::testServiceAccountFileIsRequired":0,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\ConfigurationTest::testServiceAccountFileCannotBeEmpty":0,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\RedjanYmFCMExtensionTest::testLoadRegistersServicesAndParameters":0.007,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\RedjanYmFCMExtensionTest::testClientServiceIsPublic":0,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\RedjanYmFCMExtensionTest::testNotificationFactoryServiceIsPublic":0,"RedjanYm\\FCMBundle\\Tests\\NotificationFactoryTest::testCreateDeviceNotification":0,"RedjanYm\\FCMBundle\\Tests\\NotificationFactoryTest::testCreateDeviceNotificationWithMinimalArgs":0,"RedjanYm\\FCMBundle\\Tests\\NotificationFactoryTest::testCreateTopicNotification":0,"RedjanYm\\FCMBundle\\Tests\\NotificationFactoryTest::testCreateTopicNotificationWithMinimalArgs":0,"RedjanYm\\FCMBundle\\Tests\\NotificationFactoryTest::testTopicNotificationSerializesWithTopicKey":0.001,"RedjanYm\\FCMBundle\\Tests\\NotificationFactoryTest::testDeviceNotificationSerializesWithTokenKey":0,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\RedjanYmFCMExtensionTest::testAutowiringAliases":0}}
{"version":2,"defects":{"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\RedjanYmFCMExtensionTest::testLoadRegistersServicesAndParameters":8,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\RedjanYmFCMExtensionTest::testClientServiceIsPublic":8,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\RedjanYmFCMExtensionTest::testNotificationFactoryServiceIsPublic":8},"times":{"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\ConfigurationTest::testValidConfiguration":0.007,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\ConfigurationTest::testServiceAccountFileIsRequired":0.001,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\ConfigurationTest::testServiceAccountFileCannotBeEmpty":0,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\RedjanYmFCMExtensionTest::testLoadRegistersServicesAndParameters":0.012,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\RedjanYmFCMExtensionTest::testClientServiceIsPublic":0,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\RedjanYmFCMExtensionTest::testNotificationFactoryServiceIsPublic":0,"RedjanYm\\FCMBundle\\Tests\\NotificationFactoryTest::testCreateDeviceNotification":0.001,"RedjanYm\\FCMBundle\\Tests\\NotificationFactoryTest::testCreateDeviceNotificationWithMinimalArgs":0,"RedjanYm\\FCMBundle\\Tests\\NotificationFactoryTest::testCreateTopicNotification":0,"RedjanYm\\FCMBundle\\Tests\\NotificationFactoryTest::testCreateTopicNotificationWithMinimalArgs":0,"RedjanYm\\FCMBundle\\Tests\\NotificationFactoryTest::testTopicNotificationSerializesWithTopicKey":0.001,"RedjanYm\\FCMBundle\\Tests\\NotificationFactoryTest::testDeviceNotificationSerializesWithTokenKey":0,"RedjanYm\\FCMBundle\\Tests\\DependencyInjection\\RedjanYmFCMExtensionTest::testAutowiringAliases":0}}
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('redjan_ym_fcm');
$rootNode = method_exists(TreeBuilder::class, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('redjan_ym_fcm');
$rootNode = $treeBuilder->getRootNode();

$rootNode
->children()
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY: test phpstan

test:
vendor/bin/phpunit

phpstan:
vendor/bin/phpstan analyse
4 changes: 4 additions & 0 deletions NotificationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class NotificationFactory
{
/**
* Create a notification targeted at a specific device token.
*
* @param array<string, mixed> $data
*/
public function createDeviceNotification(string $token, string $title, ?string $body = null, array $data = []): Notification
{
Expand All @@ -18,6 +20,8 @@ public function createDeviceNotification(string $token, string $title, ?string $

/**
* Create a notification targeted at a topic.
*
* @param array<string, mixed> $data
*/
public function createTopicNotification(string $topic, string $title, ?string $body = null, array $data = []): Notification
{
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"redjanym/php-firebase-cloud-messaging": "^2.1"
},
"require-dev": {
"phpunit/phpunit": "^9.5 || ^10.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.6 || ^10.0",
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
"symfony/config": "^5.4 || ^6.0 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0",
Expand Down
6 changes: 6 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
level: 6
paths:
- DependencyInjection
- NotificationFactory.php
- RedjanYmFCMBundle.php
Loading