updated-packages
This commit is contained in:
12
vendor/sly/notification-pusher/.github/FUNDING.yml
vendored
Normal file
12
vendor/sly/notification-pusher/.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# Hey there!
|
||||
#
|
||||
# I plan to develop a new version of NotificationPusher this year,
|
||||
# including many new features, and a Dockerized standalone microservice (K8s ready). 🙌🕺
|
||||
# The current version of this lib has been writen in 2013.
|
||||
#
|
||||
# Of course, this new version will respect all current PHP standards (DDD powered).
|
||||
#
|
||||
# Feel free to participate by giving a small contribution.
|
||||
# If donations allow, we'll push the project further (hosted mode, SaaS service and more).
|
||||
|
||||
custom: ["https://paypal.me/ph3nol"]
|
14
vendor/sly/notification-pusher/.travis.yml
vendored
14
vendor/sly/notification-pusher/.travis.yml
vendored
@@ -5,6 +5,8 @@ php:
|
||||
- 7.0
|
||||
- 7.1
|
||||
- 7.2
|
||||
- 7.3
|
||||
- 7.4
|
||||
|
||||
before_script:
|
||||
- composer self-update || true
|
||||
@@ -19,9 +21,9 @@ script:
|
||||
- bin/atoum
|
||||
|
||||
notifications:
|
||||
email:
|
||||
recipients:
|
||||
- cedric@dugat.me
|
||||
- seyferseed@gmail.com
|
||||
on_success: change
|
||||
on_failure: change
|
||||
email:
|
||||
recipients:
|
||||
- cedric@dugat.me
|
||||
- seyferseed@gmail.com
|
||||
on_success: change
|
||||
on_failure: change
|
||||
|
13
vendor/sly/notification-pusher/Makefile
vendored
Normal file
13
vendor/sly/notification-pusher/Makefile
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
php_bash:
|
||||
docker-compose -f docker-compose.yml exec php-cli bash -l -c "export TERM=xterm; export COLUMNS=`tput cols`; export LINES=`tput lines`; exec bash -l"
|
||||
|
||||
atoum:
|
||||
docker-compose -f docker-compose.yml exec php-cli bash -c "./bin/atoum"
|
||||
|
||||
up:
|
||||
docker-compose -f docker-compose.yml up -d
|
||||
|
||||
down:
|
||||
docker-compose -f docker-compose.yml down --rmi local --volumes
|
||||
|
||||
restart: down up
|
2
vendor/sly/notification-pusher/README.md
vendored
2
vendor/sly/notification-pusher/README.md
vendored
@@ -52,10 +52,10 @@ or `include vendor/autoload.php` in your index.php.
|
||||
|
||||
## Todo
|
||||
|
||||
* Rewrite tests in PHPUnit 8+. (contributions are welcome!)
|
||||
* Add new features (custom APNS payloads, GCM and FCM custom options, etc.)
|
||||
* Add new adapters (like Blackberry and Windows phones)
|
||||
* Write more documentation and examples!
|
||||
* Write more tests. (contributions are welcome!)
|
||||
|
||||
## 1.x users
|
||||
|
||||
|
106
vendor/sly/notification-pusher/composer.json
vendored
106
vendor/sly/notification-pusher/composer.json
vendored
@@ -1,56 +1,58 @@
|
||||
{
|
||||
"name": "sly/notification-pusher",
|
||||
"description": "Standalone PHP library for easy devices notifications push.",
|
||||
"keywords": [
|
||||
"apple",
|
||||
"iphone",
|
||||
"apns",
|
||||
"android",
|
||||
"gcm",
|
||||
"notification",
|
||||
"message",
|
||||
"push",
|
||||
"pusher"
|
||||
],
|
||||
"homepage": "https://github.com/Ph3nol/NotificationPusher",
|
||||
"type": "standalone",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Cédric Dugat",
|
||||
"email": "cedric@dugat.me"
|
||||
"name": "sly/notification-pusher",
|
||||
"description": "Standalone PHP library for easy devices notifications push.",
|
||||
"keywords": [
|
||||
"apple",
|
||||
"iphone",
|
||||
"apns",
|
||||
"android",
|
||||
"gcm",
|
||||
"notification",
|
||||
"message",
|
||||
"push",
|
||||
"pusher"
|
||||
],
|
||||
"homepage": "https://github.com/Ph3nol/NotificationPusher",
|
||||
"type": "standalone",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Cédric Dugat",
|
||||
"email": "cedric@dugat.me"
|
||||
},
|
||||
{
|
||||
"name": "Contributors",
|
||||
"homepage": "https://github.com/Ph3nol/NotificationPusher/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.6",
|
||||
"ext-ctype": "*",
|
||||
"symfony/options-resolver": ">=2.3,<5",
|
||||
"symfony/console": ">=2.3,<5",
|
||||
"symfony/process": ">=2.3,<5",
|
||||
"zendframework/zendservice-apple-apns": "~1.4",
|
||||
"zendframework/zendservice-google-gcm": "~2.1",
|
||||
"zendframework/zend-validator": "^2.12",
|
||||
"doctrine/inflector": "~1.1",
|
||||
"symfony/filesystem": ">=2.3,<5",
|
||||
"symfony/debug": ">=2.3,<5"
|
||||
},
|
||||
{
|
||||
"name": "Contributors",
|
||||
"homepage": "https://github.com/Ph3nol/NotificationPusher/contributors"
|
||||
"require-dev": {
|
||||
"atoum/atoum": "^3.1",
|
||||
"atoum/stubs": "^2.5",
|
||||
"symfony/var-dumper": ">=2.3,<5",
|
||||
"atoum/visibility-extension": "^1.3"
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin"
|
||||
},
|
||||
"bin": [
|
||||
"np"
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Sly\\": "src/Sly/"
|
||||
}
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.6",
|
||||
"symfony/options-resolver": ">=2.3,<5",
|
||||
"symfony/console": ">=2.3,<5",
|
||||
"symfony/process": ">=2.3,<5",
|
||||
"zendframework/zendservice-apple-apns": "~1.0",
|
||||
"zendframework/zendservice-google-gcm": "~2.0",
|
||||
"doctrine/inflector": "1.*",
|
||||
"symfony/filesystem": ">=2.3,<5",
|
||||
"symfony/debug": ">=2.3,<5"
|
||||
},
|
||||
"require-dev": {
|
||||
"atoum/atoum": "^3.1",
|
||||
"atoum/stubs": "^2.5",
|
||||
"symfony/var-dumper": ">=2.3,<5",
|
||||
"atoum/visibility-extension": "^1.3"
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin"
|
||||
},
|
||||
"bin": [
|
||||
"np"
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Sly\\": "src/Sly/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
379
vendor/sly/notification-pusher/composer.lock
generated
vendored
379
vendor/sly/notification-pusher/composer.lock
generated
vendored
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "d0bfb04c59c6143cbca4f1362aecf2b5",
|
||||
"content-hash": "e5760089754b557cdb9a3912f539c70b",
|
||||
"packages": [
|
||||
{
|
||||
"name": "container-interop/container-interop",
|
||||
@@ -35,6 +35,7 @@
|
||||
],
|
||||
"description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
|
||||
"homepage": "https://github.com/container-interop/container-interop",
|
||||
"abandoned": "psr/container",
|
||||
"time": "2017-02-14T19:40:03+00:00"
|
||||
},
|
||||
{
|
||||
@@ -155,16 +156,16 @@
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.0.2",
|
||||
"version": "1.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
|
||||
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc",
|
||||
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -173,7 +174,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
"dev-master": "1.1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -198,20 +199,20 @@
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2016-10-10T12:19:37+00:00"
|
||||
"time": "2020-03-23T09:12:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v3.4.4",
|
||||
"version": "v3.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "26b6f419edda16c19775211987651cb27baea7f1"
|
||||
"reference": "9468ad3fba3a5e1f0dc12a96e50e84cddb923cf0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/26b6f419edda16c19775211987651cb27baea7f1",
|
||||
"reference": "26b6f419edda16c19775211987651cb27baea7f1",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/9468ad3fba3a5e1f0dc12a96e50e84cddb923cf0",
|
||||
"reference": "9468ad3fba3a5e1f0dc12a96e50e84cddb923cf0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -267,20 +268,20 @@
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2018-01-29T09:03:43+00:00"
|
||||
"time": "2017-11-29T13:28:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
"version": "v3.4.4",
|
||||
"version": "v3.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/debug.git",
|
||||
"reference": "53f6af2805daf52a43b393b93d2f24925d35c937"
|
||||
"reference": "fb2001e5d85f95d8b6ab94ae3be5d2672df128fd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/53f6af2805daf52a43b393b93d2f24925d35c937",
|
||||
"reference": "53f6af2805daf52a43b393b93d2f24925d35c937",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/fb2001e5d85f95d8b6ab94ae3be5d2672df128fd",
|
||||
"reference": "fb2001e5d85f95d8b6ab94ae3be5d2672df128fd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -323,20 +324,20 @@
|
||||
],
|
||||
"description": "Symfony Debug Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2018-01-18T22:16:57+00:00"
|
||||
"time": "2017-11-21T09:01:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/filesystem",
|
||||
"version": "v3.4.4",
|
||||
"version": "v3.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/filesystem.git",
|
||||
"reference": "e078773ad6354af38169faf31c21df0f18ace03d"
|
||||
"reference": "de56eee71e0a128d8c54ccc1909cdefd574bad0f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/e078773ad6354af38169faf31c21df0f18ace03d",
|
||||
"reference": "e078773ad6354af38169faf31c21df0f18ace03d",
|
||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/de56eee71e0a128d8c54ccc1909cdefd574bad0f",
|
||||
"reference": "de56eee71e0a128d8c54ccc1909cdefd574bad0f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -372,20 +373,20 @@
|
||||
],
|
||||
"description": "Symfony Filesystem Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2018-01-03T07:37:34+00:00"
|
||||
"time": "2017-11-19T18:59:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/options-resolver",
|
||||
"version": "v3.4.4",
|
||||
"version": "v3.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/options-resolver.git",
|
||||
"reference": "f3109a6aedd20e35c3a33190e932c2b063b7b50e"
|
||||
"reference": "08748edfe6982f4d878cc42b8325b19a276fb1cf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/f3109a6aedd20e35c3a33190e932c2b063b7b50e",
|
||||
"reference": "f3109a6aedd20e35c3a33190e932c2b063b7b50e",
|
||||
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/08748edfe6982f4d878cc42b8325b19a276fb1cf",
|
||||
"reference": "08748edfe6982f4d878cc42b8325b19a276fb1cf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -426,20 +427,20 @@
|
||||
"configuration",
|
||||
"options"
|
||||
],
|
||||
"time": "2018-01-11T07:56:07+00:00"
|
||||
"time": "2017-11-05T16:10:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.7.0",
|
||||
"version": "v1.17.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b"
|
||||
"reference": "fa79b11539418b02fc5e1897267673ba2c19419c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b",
|
||||
"reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c",
|
||||
"reference": "fa79b11539418b02fc5e1897267673ba2c19419c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -451,7 +452,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.7-dev"
|
||||
"dev-master": "1.17-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -485,20 +486,20 @@
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2018-01-30T19:27:44+00:00"
|
||||
"time": "2020-05-12T16:47:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v3.4.4",
|
||||
"version": "v3.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "09a5172057be8fc677840e591b17f385e58c7c0d"
|
||||
"reference": "db25e810fd5e124085e3777257d0cf4ae533d0ea"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/09a5172057be8fc677840e591b17f385e58c7c0d",
|
||||
"reference": "09a5172057be8fc677840e591b17f385e58c7c0d",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/db25e810fd5e124085e3777257d0cf4ae533d0ea",
|
||||
"reference": "db25e810fd5e124085e3777257d0cf4ae533d0ea",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -534,34 +535,34 @@
|
||||
],
|
||||
"description": "Symfony Process Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2018-01-29T09:03:43+00:00"
|
||||
"time": "2017-11-22T12:18:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zend-escaper",
|
||||
"version": "2.5.2",
|
||||
"version": "2.6.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zend-escaper.git",
|
||||
"reference": "2dcd14b61a72d8b8e27d579c6344e12c26141d4e"
|
||||
"reference": "3801caa21b0ca6aca57fa1c42b08d35c395ebd5f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/2dcd14b61a72d8b8e27d579c6344e12c26141d4e",
|
||||
"reference": "2dcd14b61a72d8b8e27d579c6344e12c26141d4e",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/3801caa21b0ca6aca57fa1c42b08d35c395ebd5f",
|
||||
"reference": "3801caa21b0ca6aca57fa1c42b08d35c395ebd5f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5"
|
||||
"php": "^5.6 || ^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"fabpot/php-cs-fixer": "1.7.*",
|
||||
"phpunit/phpunit": "~4.0"
|
||||
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2",
|
||||
"zendframework/zend-coding-standard": "~1.0.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev",
|
||||
"dev-develop": "2.6-dev"
|
||||
"dev-master": "2.6.x-dev",
|
||||
"dev-develop": "2.7.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -573,44 +574,49 @@
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"homepage": "https://github.com/zendframework/zend-escaper",
|
||||
"description": "Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs",
|
||||
"keywords": [
|
||||
"ZendFramework",
|
||||
"escaper",
|
||||
"zf2"
|
||||
"zf"
|
||||
],
|
||||
"time": "2016-06-30T19:48:38+00:00"
|
||||
"abandoned": "laminas/laminas-escaper",
|
||||
"time": "2019-09-05T20:03:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zend-http",
|
||||
"version": "2.7.0",
|
||||
"version": "2.11.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zend-http.git",
|
||||
"reference": "78aa510c0ea64bfb2aa234f50c4f232c9531acfa"
|
||||
"reference": "e15e0ce45a2a4f642cd0b7b4f4d4d0366b729a1a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-http/zipball/78aa510c0ea64bfb2aa234f50c4f232c9531acfa",
|
||||
"reference": "78aa510c0ea64bfb2aa234f50c4f232c9531acfa",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-http/zipball/e15e0ce45a2a4f642cd0b7b4f4d4d0366b729a1a",
|
||||
"reference": "e15e0ce45a2a4f642cd0b7b4f4d4d0366b729a1a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0",
|
||||
"zendframework/zend-loader": "^2.5.1",
|
||||
"zendframework/zend-stdlib": "^3.1 || ^2.7.7",
|
||||
"zendframework/zend-stdlib": "^3.2.1",
|
||||
"zendframework/zend-uri": "^2.5.2",
|
||||
"zendframework/zend-validator": "^2.10.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6.4.1 || ^5.7.15",
|
||||
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.3",
|
||||
"zendframework/zend-coding-standard": "~1.0.0",
|
||||
"zendframework/zend-config": "^3.1 || ^2.6"
|
||||
},
|
||||
"suggest": {
|
||||
"paragonie/certainty": "For automated management of cacert.pem"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.7-dev",
|
||||
"dev-develop": "2.8-dev"
|
||||
"dev-master": "2.11.x-dev",
|
||||
"dev-develop": "2.12.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -622,8 +628,7 @@
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "provides an easy interface for performing Hyper-Text Transfer Protocol (HTTP) requests",
|
||||
"homepage": "https://github.com/zendframework/zend-http",
|
||||
"description": "Provides an easy interface for performing Hyper-Text Transfer Protocol (HTTP) requests",
|
||||
"keywords": [
|
||||
"ZendFramework",
|
||||
"http",
|
||||
@@ -631,44 +636,40 @@
|
||||
"zend",
|
||||
"zf"
|
||||
],
|
||||
"time": "2017-10-13T12:06:24+00:00"
|
||||
"abandoned": "laminas/laminas-http",
|
||||
"time": "2019-12-30T20:47:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zend-json",
|
||||
"version": "2.6.1",
|
||||
"version": "3.1.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zend-json.git",
|
||||
"reference": "4c8705dbe4ad7d7e51b2876c5b9eea0ef916ba28"
|
||||
"reference": "e9ddb1192d93fe7fff846ac895249c39db75132b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-json/zipball/4c8705dbe4ad7d7e51b2876c5b9eea0ef916ba28",
|
||||
"reference": "4c8705dbe4ad7d7e51b2876c5b9eea0ef916ba28",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-json/zipball/e9ddb1192d93fe7fff846ac895249c39db75132b",
|
||||
"reference": "e9ddb1192d93fe7fff846ac895249c39db75132b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.5 || ^7.0"
|
||||
"php": "^5.6 || ^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"fabpot/php-cs-fixer": "1.7.*",
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"zendframework/zend-http": "^2.5.4",
|
||||
"zendframework/zend-server": "^2.6.1",
|
||||
"zendframework/zend-stdlib": "^2.5 || ^3.0",
|
||||
"zendframework/zendxml": "^1.0.2"
|
||||
"phpunit/phpunit": "^5.7.23 || ^6.4.3",
|
||||
"zendframework/zend-coding-standard": "~1.0.0",
|
||||
"zendframework/zend-stdlib": "^2.7.7 || ^3.1"
|
||||
},
|
||||
"suggest": {
|
||||
"zendframework/zend-http": "Zend\\Http component, required to use Zend\\Json\\Server",
|
||||
"zendframework/zend-server": "Zend\\Server component, required to use Zend\\Json\\Server",
|
||||
"zendframework/zend-stdlib": "Zend\\Stdlib component, for use with caching Zend\\Json\\Server responses",
|
||||
"zendframework/zendxml": "To support Zend\\Json\\Json::fromXml() usage"
|
||||
"zendframework/zend-json-server": "For implementing JSON-RPC servers",
|
||||
"zendframework/zend-xml2json": "For converting XML documents to JSON"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.6-dev",
|
||||
"dev-develop": "2.7-dev"
|
||||
"dev-master": "3.1.x-dev",
|
||||
"dev-develop": "3.2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -681,39 +682,40 @@
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "provides convenience methods for serializing native PHP to JSON and decoding JSON to native PHP",
|
||||
"homepage": "https://github.com/zendframework/zend-json",
|
||||
"keywords": [
|
||||
"ZendFramework",
|
||||
"json",
|
||||
"zf2"
|
||||
"zf"
|
||||
],
|
||||
"time": "2016-02-04T21:20:26+00:00"
|
||||
"abandoned": "laminas/laminas-json",
|
||||
"time": "2019-10-09T13:56:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zend-loader",
|
||||
"version": "2.5.1",
|
||||
"version": "2.6.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zend-loader.git",
|
||||
"reference": "c5fd2f071bde071f4363def7dea8dec7393e135c"
|
||||
"reference": "91da574d29b58547385b2298c020b257310898c6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-loader/zipball/c5fd2f071bde071f4363def7dea8dec7393e135c",
|
||||
"reference": "c5fd2f071bde071f4363def7dea8dec7393e135c",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-loader/zipball/91da574d29b58547385b2298c020b257310898c6",
|
||||
"reference": "91da574d29b58547385b2298c020b257310898c6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.23"
|
||||
"php": "^5.6 || ^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"fabpot/php-cs-fixer": "1.7.*",
|
||||
"phpunit/phpunit": "~4.0"
|
||||
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.4",
|
||||
"zendframework/zend-coding-standard": "~1.0.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev",
|
||||
"dev-develop": "2.6-dev"
|
||||
"dev-master": "2.6.x-dev",
|
||||
"dev-develop": "2.7.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -725,40 +727,42 @@
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"homepage": "https://github.com/zendframework/zend-loader",
|
||||
"description": "Autoloading and plugin loading strategies",
|
||||
"keywords": [
|
||||
"ZendFramework",
|
||||
"loader",
|
||||
"zf2"
|
||||
"zf"
|
||||
],
|
||||
"time": "2015-06-03T14:05:47+00:00"
|
||||
"abandoned": "laminas/laminas-loader",
|
||||
"time": "2019-09-04T19:38:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zend-stdlib",
|
||||
"version": "3.1.0",
|
||||
"version": "3.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zend-stdlib.git",
|
||||
"reference": "debedcfc373a293f9250cc9aa03cf121428c8e78"
|
||||
"reference": "66536006722aff9e62d1b331025089b7ec71c065"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/debedcfc373a293f9250cc9aa03cf121428c8e78",
|
||||
"reference": "debedcfc373a293f9250cc9aa03cf121428c8e78",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/66536006722aff9e62d1b331025089b7ec71c065",
|
||||
"reference": "66536006722aff9e62d1b331025089b7ec71c065",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"athletic/athletic": "~0.1",
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"squizlabs/php_codesniffer": "^2.6.2"
|
||||
"phpbench/phpbench": "^0.13",
|
||||
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2",
|
||||
"zendframework/zend-coding-standard": "~1.0.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.1-dev",
|
||||
"dev-develop": "3.2-dev"
|
||||
"dev-master": "3.2.x-dev",
|
||||
"dev-develop": "3.3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -770,41 +774,43 @@
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"homepage": "https://github.com/zendframework/zend-stdlib",
|
||||
"description": "SPL extensions, array utilities, error handlers, and more",
|
||||
"keywords": [
|
||||
"ZendFramework",
|
||||
"stdlib",
|
||||
"zf2"
|
||||
"zf"
|
||||
],
|
||||
"time": "2016-09-13T14:38:50+00:00"
|
||||
"abandoned": "laminas/laminas-stdlib",
|
||||
"time": "2018-08-28T21:34:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zend-uri",
|
||||
"version": "2.5.2",
|
||||
"version": "2.7.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zend-uri.git",
|
||||
"reference": "0bf717a239432b1a1675ae314f7c4acd742749ed"
|
||||
"reference": "bfc4a5b9a309711e968d7c72afae4ac50c650083"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-uri/zipball/0bf717a239432b1a1675ae314f7c4acd742749ed",
|
||||
"reference": "0bf717a239432b1a1675ae314f7c4acd742749ed",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-uri/zipball/bfc4a5b9a309711e968d7c72afae4ac50c650083",
|
||||
"reference": "bfc4a5b9a309711e968d7c72afae4ac50c650083",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.5 || ^7.0",
|
||||
"php": "^5.6 || ^7.0",
|
||||
"zendframework/zend-escaper": "^2.5",
|
||||
"zendframework/zend-validator": "^2.5"
|
||||
"zendframework/zend-validator": "^2.10"
|
||||
},
|
||||
"require-dev": {
|
||||
"fabpot/php-cs-fixer": "1.7.*",
|
||||
"phpunit/phpunit": "~4.0"
|
||||
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.4",
|
||||
"zendframework/zend-coding-standard": "~1.0.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev",
|
||||
"dev-develop": "2.6-dev"
|
||||
"dev-master": "2.7.x-dev",
|
||||
"dev-develop": "2.8.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -816,35 +822,37 @@
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "a component that aids in manipulating and validating » Uniform Resource Identifiers (URIs)",
|
||||
"homepage": "https://github.com/zendframework/zend-uri",
|
||||
"description": "A component that aids in manipulating and validating » Uniform Resource Identifiers (URIs)",
|
||||
"keywords": [
|
||||
"ZendFramework",
|
||||
"uri",
|
||||
"zf2"
|
||||
"zf"
|
||||
],
|
||||
"time": "2016-02-17T22:38:51+00:00"
|
||||
"abandoned": "laminas/laminas-uri",
|
||||
"time": "2019-10-07T13:35:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zend-validator",
|
||||
"version": "2.10.2",
|
||||
"version": "2.12.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zend-validator.git",
|
||||
"reference": "38109ed7d8e46cfa71bccbe7e6ca80cdd035f8c9"
|
||||
"reference": "fd24920c2afcf2a70d11f67c3457f8f509453a62"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-validator/zipball/38109ed7d8e46cfa71bccbe7e6ca80cdd035f8c9",
|
||||
"reference": "38109ed7d8e46cfa71bccbe7e6ca80cdd035f8c9",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-validator/zipball/fd24920c2afcf2a70d11f67c3457f8f509453a62",
|
||||
"reference": "fd24920c2afcf2a70d11f67c3457f8f509453a62",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"container-interop/container-interop": "^1.1",
|
||||
"php": "^5.6 || ^7.0",
|
||||
"zendframework/zend-stdlib": "^2.7.6 || ^3.1"
|
||||
"zendframework/zend-stdlib": "^3.2.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6.0.8 || ^5.7.15",
|
||||
"psr/http-message": "^1.0",
|
||||
"zendframework/zend-cache": "^2.6.1",
|
||||
"zendframework/zend-coding-standard": "~1.0.0",
|
||||
"zendframework/zend-config": "^2.6",
|
||||
@@ -858,6 +866,7 @@
|
||||
"zendframework/zend-uri": "^2.5"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/http-message": "psr/http-message, required when validating PSR-7 UploadedFileInterface instances via the Upload and UploadFile validators",
|
||||
"zendframework/zend-db": "Zend\\Db component, required by the (No)RecordExists validator",
|
||||
"zendframework/zend-filter": "Zend\\Filter component, required by the Digits validator",
|
||||
"zendframework/zend-i18n": "Zend\\I18n component to allow translation of validation error messages",
|
||||
@@ -870,8 +879,8 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.10.x-dev",
|
||||
"dev-develop": "2.11.x-dev"
|
||||
"dev-master": "2.12.x-dev",
|
||||
"dev-develop": "2.13.x-dev"
|
||||
},
|
||||
"zf": {
|
||||
"component": "Zend\\Validator",
|
||||
@@ -887,83 +896,98 @@
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "provides a set of commonly needed validators",
|
||||
"homepage": "https://github.com/zendframework/zend-validator",
|
||||
"description": "Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria",
|
||||
"keywords": [
|
||||
"ZendFramework",
|
||||
"validator",
|
||||
"zf2"
|
||||
"zf"
|
||||
],
|
||||
"time": "2018-02-01T17:05:33+00:00"
|
||||
"abandoned": "laminas/laminas-validator",
|
||||
"time": "2019-10-29T08:33:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zendservice-apple-apns",
|
||||
"version": "1.2.0",
|
||||
"version": "1.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/ZendService_Apple_Apns.git",
|
||||
"reference": "ee2c44ee833206c1eb95b2fb7be1e2335e7570eb"
|
||||
"reference": "a8919519edf9ac4658e7f61cb39c4dfe65b5bd49"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zendframework/ZendService_Apple_Apns/zipball/ee2c44ee833206c1eb95b2fb7be1e2335e7570eb",
|
||||
"reference": "ee2c44ee833206c1eb95b2fb7be1e2335e7570eb",
|
||||
"url": "https://api.github.com/repos/zendframework/ZendService_Apple_Apns/zipball/a8919519edf9ac4658e7f61cb39c4dfe65b5bd49",
|
||||
"reference": "a8919519edf9ac4658e7f61cb39c4dfe65b5bd49",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"zendframework/zend-json": "~2.0"
|
||||
"php": "^5.6 || ^7.0",
|
||||
"zendframework/zend-json": "^2.0 || ^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "3.7.*"
|
||||
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.5",
|
||||
"zendframework/zend-coding-standard": "~1.0.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.4.x-dev",
|
||||
"dev-develop": "1.5.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"ZendService\\Apple\\Apns\\": "library/",
|
||||
"ZendService\\Apple\\Exception\\": "library/"
|
||||
"psr-4": {
|
||||
"ZendService\\Apple\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "OOP Zend Framework 2 wrapper for Apple Push Notification Service",
|
||||
"homepage": "http://packages.zendframework.com/",
|
||||
"description": "OOP Zend Framework wrapper for Apple Push Notification Service",
|
||||
"keywords": [
|
||||
"ZendFramework",
|
||||
"apns",
|
||||
"apple",
|
||||
"notification",
|
||||
"push",
|
||||
"zf2"
|
||||
"zf"
|
||||
],
|
||||
"time": "2015-12-09T22:55:07+00:00"
|
||||
"abandoned": true,
|
||||
"time": "2019-03-14T17:18:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zendservice-google-gcm",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/ZendService_Google_Gcm.git",
|
||||
"reference": "617221cb04e75c05080ceec61f31c71566e0b999"
|
||||
"reference": "141ac74b4a76656dac48bb97c7be4fc336d075ae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zendframework/ZendService_Google_Gcm/zipball/617221cb04e75c05080ceec61f31c71566e0b999",
|
||||
"reference": "617221cb04e75c05080ceec61f31c71566e0b999",
|
||||
"url": "https://api.github.com/repos/zendframework/ZendService_Google_Gcm/zipball/141ac74b4a76656dac48bb97c7be4fc336d075ae",
|
||||
"reference": "141ac74b4a76656dac48bb97c7be4fc336d075ae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.5 || ^7.0",
|
||||
"php": "^5.6 || ^7.0",
|
||||
"zendframework/zend-http": "^2.0",
|
||||
"zendframework/zend-json": "^2.0"
|
||||
"zendframework/zend-json": "^2.0 || ^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8"
|
||||
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.5",
|
||||
"zendframework/zend-coding-standard": "~1.0.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1.x-dev",
|
||||
"dev-develop": "2.2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"ZendService\\Google\\": "library/"
|
||||
"ZendService\\Google\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
@@ -971,30 +995,31 @@
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "OOP wrapper for Google Cloud Messaging",
|
||||
"homepage": "https://github.com/zendframework/zendservice-google-gcm",
|
||||
"keywords": [
|
||||
"ZendFramework",
|
||||
"gcm",
|
||||
"google",
|
||||
"notification",
|
||||
"push",
|
||||
"zf2"
|
||||
"zf"
|
||||
],
|
||||
"time": "2017-01-17T13:57:50+00:00"
|
||||
"abandoned": true,
|
||||
"time": "2019-02-07T18:01:00+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "atoum/atoum",
|
||||
"version": "3.2.0",
|
||||
"version": "3.4.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/atoum/atoum.git",
|
||||
"reference": "6f4ab88f3a1826aed2372c9f7f0d53b9303f672a"
|
||||
"reference": "e90606b89e62c5c18c5d02596078edf55f35b3c3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/atoum/atoum/zipball/6f4ab88f3a1826aed2372c9f7f0d53b9303f672a",
|
||||
"reference": "6f4ab88f3a1826aed2372c9f7f0d53b9303f672a",
|
||||
"url": "https://api.github.com/repos/atoum/atoum/zipball/e90606b89e62c5c18c5d02596078edf55f35b3c3",
|
||||
"reference": "e90606b89e62c5c18c5d02596078edf55f35b3c3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1002,13 +1027,13 @@
|
||||
"ext-json": "*",
|
||||
"ext-tokenizer": "*",
|
||||
"ext-xml": "*",
|
||||
"php": "^5.6.0 || ^7.0.0"
|
||||
"php": "^5.6.0 || ^7.0.0 <7.5.0"
|
||||
},
|
||||
"replace": {
|
||||
"mageekguy/atoum": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "~1.12"
|
||||
"friendsofphp/php-cs-fixer": "^2"
|
||||
},
|
||||
"suggest": {
|
||||
"atoum/stubs": "Provides IDE support (like autocompletion) for atoum",
|
||||
@@ -1064,20 +1089,20 @@
|
||||
"test",
|
||||
"unit testing"
|
||||
],
|
||||
"time": "2017-09-07T08:27:13+00:00"
|
||||
"time": "2020-03-04T10:29:09+00:00"
|
||||
},
|
||||
{
|
||||
"name": "atoum/stubs",
|
||||
"version": "2.5.0",
|
||||
"version": "2.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/atoum/stubs.git",
|
||||
"reference": "45babf1aa5042a99c68fe8a17e1229d7c21407cb"
|
||||
"reference": "df8b73b0358de7283ecba91d8f4a9683f583993d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/atoum/stubs/zipball/45babf1aa5042a99c68fe8a17e1229d7c21407cb",
|
||||
"reference": "45babf1aa5042a99c68fe8a17e1229d7c21407cb",
|
||||
"url": "https://api.github.com/repos/atoum/stubs/zipball/df8b73b0358de7283ecba91d8f4a9683f583993d",
|
||||
"reference": "df8b73b0358de7283ecba91d8f4a9683f583993d",
|
||||
"shasum": ""
|
||||
},
|
||||
"suggest": {
|
||||
@@ -1091,7 +1116,7 @@
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD"
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
@@ -1111,7 +1136,7 @@
|
||||
"test",
|
||||
"unit testing"
|
||||
],
|
||||
"time": "2016-01-07T19:57:29+00:00"
|
||||
"time": "2018-01-29T22:41:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "atoum/visibility-extension",
|
||||
@@ -1163,16 +1188,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-dumper",
|
||||
"version": "v3.4.4",
|
||||
"version": "v3.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/var-dumper.git",
|
||||
"reference": "472a9849930cf21f73abdb02240f17cf5b5bd1a7"
|
||||
"reference": "ec650a975a8e04e0c114d35eab732981243db3a2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/472a9849930cf21f73abdb02240f17cf5b5bd1a7",
|
||||
"reference": "472a9849930cf21f73abdb02240f17cf5b5bd1a7",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/ec650a975a8e04e0c114d35eab732981243db3a2",
|
||||
"reference": "ec650a975a8e04e0c114d35eab732981243db3a2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1228,7 +1253,7 @@
|
||||
"debug",
|
||||
"dump"
|
||||
],
|
||||
"time": "2018-01-29T09:03:43+00:00"
|
||||
"time": "2017-11-30T14:59:23+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
@@ -1237,7 +1262,9 @@
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=5.6"
|
||||
"php": ">=5.6",
|
||||
"ext-ctype": "*"
|
||||
},
|
||||
"platform-dev": []
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "1.1.0"
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ Also, facades provide useful methods to filter successful and invalid tokens fro
|
||||
|
||||
### The Response
|
||||
|
||||
```
|
||||
``` php
|
||||
$response->getParsedResponses();
|
||||
$response->getOriginalResponses();
|
||||
$response->getPushCollection();
|
||||
@@ -18,7 +18,7 @@ $response->getPushCollection();
|
||||
|
||||
### Android facade
|
||||
|
||||
```
|
||||
``` php
|
||||
$android_api_key = 'key';
|
||||
|
||||
//get tokens list from your service
|
||||
@@ -56,7 +56,7 @@ die(dump($response, $invalidTokens, $successfulTokens));
|
||||
|
||||
### APNS facade
|
||||
|
||||
```
|
||||
``` php
|
||||
$certificatePath = 'cert.pem';
|
||||
$passPhrase = '';
|
||||
|
||||
@@ -102,4 +102,4 @@ die(dump($response, $feedback, $invalidTokens, $successfulTokens));
|
||||
* [GCM (FCM) adapter](https://github.com/Ph3nol/NotificationPusher/blob/master/doc/gcm-fcm-adapter.md)
|
||||
* [Create an adapter](https://github.com/Ph3nol/NotificationPusher/blob/master/doc/create-an-adapter.md)
|
||||
* [Push from CLI](https://github.com/Ph3nol/NotificationPusher/blob/master/doc/push-from-cli.md)
|
||||
* Facades
|
||||
* Facades
|
||||
|
@@ -5,6 +5,9 @@
|
||||
[GCM](http://developer.android.com/google/gcm/gs.html) adapter is used to push notification to Google/Android devices.
|
||||
[FCM](https://firebase.google.com/docs/cloud-messaging/) is supported. Please see [this comment](https://github.com/Ph3nol/NotificationPusher/pull/141#issuecomment-318896948) for explanation.
|
||||
|
||||
##### Important
|
||||
Parameter `notificatinData` is mandatory for sending messagev via FCM.
|
||||
|
||||
### Custom notification push example
|
||||
|
||||
``` php
|
||||
@@ -78,4 +81,4 @@ foreach($push->getResponses() as $token => $response) {
|
||||
* GCM (FCM) adapter
|
||||
* [Create an adapter](https://github.com/Ph3nol/NotificationPusher/blob/master/doc/create-an-adapter.md)
|
||||
* [Push from CLI](https://github.com/Ph3nol/NotificationPusher/blob/master/doc/push-from-cli.md)
|
||||
* [Facades](https://github.com/Ph3nol/NotificationPusher/blob/master/doc/facades.md)
|
||||
* [Facades](https://github.com/Ph3nol/NotificationPusher/blob/master/doc/facades.md)
|
||||
|
6
vendor/sly/notification-pusher/docker-compose.yml
vendored
Normal file
6
vendor/sly/notification-pusher/docker-compose.yml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
version: "2.0"
|
||||
services:
|
||||
php-cli:
|
||||
build: ./docker/php-cli
|
||||
volumes:
|
||||
- ./:/var/www
|
9
vendor/sly/notification-pusher/docker/php-cli/Dockerfile
vendored
Normal file
9
vendor/sly/notification-pusher/docker/php-cli/Dockerfile
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
FROM php:7.4-cli
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl git
|
||||
|
||||
WORKDIR /var/www
|
||||
|
||||
#make it running
|
||||
ENTRYPOINT ["tail", "-f", "/dev/null"]
|
@@ -11,6 +11,9 @@ namespace Sly\NotificationPusher;
|
||||
|
||||
use Sly\NotificationPusher\Model\ResponseInterface;
|
||||
|
||||
/**
|
||||
* @author Oleg Abrazhaev <seyferseed@gmail.com>
|
||||
*/
|
||||
abstract class AbstractPushService
|
||||
{
|
||||
/**
|
||||
@@ -24,7 +27,6 @@ abstract class AbstractPushService
|
||||
protected $response;
|
||||
|
||||
/**
|
||||
* AbstractPushService constructor.
|
||||
* @param string $environment
|
||||
*/
|
||||
public function __construct($environment = PushManager::ENVIRONMENT_DEV)
|
||||
@@ -39,4 +41,4 @@ abstract class AbstractPushService
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,29 +11,23 @@
|
||||
|
||||
namespace Sly\NotificationPusher\Adapter;
|
||||
|
||||
use Sly\NotificationPusher\Collection\DeviceCollection;
|
||||
use Sly\NotificationPusher\Model\PushInterface;
|
||||
use Sly\NotificationPusher\Model\Response;
|
||||
use Sly\NotificationPusher\Model\ResponseInterface;
|
||||
|
||||
/**
|
||||
* AdapterInterface.
|
||||
*
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
interface AdapterInterface
|
||||
{
|
||||
/**
|
||||
* Push.
|
||||
* @param PushInterface $push Push
|
||||
*
|
||||
* @param \Sly\NotificationPusher\Model\PushInterface $push Push
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Collection\DeviceCollection
|
||||
* @return DeviceCollection
|
||||
*/
|
||||
public function push(PushInterface $push);
|
||||
|
||||
/**
|
||||
* Supports.
|
||||
*
|
||||
* @param string $token Token
|
||||
*
|
||||
* @return boolean
|
||||
@@ -51,39 +45,29 @@ interface AdapterInterface
|
||||
public function setResponse(ResponseInterface $response);
|
||||
|
||||
/**
|
||||
* Get defined parameters.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDefinedParameters();
|
||||
|
||||
/**
|
||||
* Get default parameters.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDefaultParameters();
|
||||
|
||||
/**
|
||||
* Get required parameters.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getRequiredParameters();
|
||||
|
||||
/**
|
||||
* Get Environment.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEnvironment();
|
||||
|
||||
/**
|
||||
* Set Environment.
|
||||
*
|
||||
* @param string $environment Environment value to set
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Adapter\AdapterInterface
|
||||
* @return AdapterInterface
|
||||
*/
|
||||
public function setEnvironment($environment);
|
||||
}
|
||||
|
@@ -16,17 +16,17 @@ use Sly\NotificationPusher\Exception\AdapterException;
|
||||
use Sly\NotificationPusher\Exception\PushException;
|
||||
use Sly\NotificationPusher\Model\BaseOptionedModel;
|
||||
use Sly\NotificationPusher\Model\DeviceInterface;
|
||||
use Sly\NotificationPusher\Model\MessageInterface;
|
||||
use Sly\NotificationPusher\Model\PushInterface;
|
||||
use ZendService\Apple\Apns\Client\AbstractClient as ServiceAbstractClient;
|
||||
use ZendService\Apple\Apns\Client\Feedback as ServiceFeedbackClient;
|
||||
use ZendService\Apple\Apns\Client\Message as ServiceClient;
|
||||
use ZendService\Apple\Apns\Message as ServiceMessage;
|
||||
use ZendService\Apple\Apns\Message\Alert as ServiceAlert;
|
||||
use ZendService\Apple\Apns\Response\Feedback;
|
||||
use ZendService\Apple\Apns\Response\Message as ServiceResponse;
|
||||
|
||||
/**
|
||||
* APNS adapter.
|
||||
*
|
||||
* @uses \Sly\NotificationPusher\Adapter\BaseAdapter
|
||||
*
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
@@ -47,7 +47,7 @@ class Apns extends BaseAdapter implements FeedbackAdapterInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws \Sly\NotificationPusher\Exception\AdapterException
|
||||
* @throws AdapterException
|
||||
*/
|
||||
public function __construct(array $parameters = [])
|
||||
{
|
||||
@@ -63,7 +63,7 @@ class Apns extends BaseAdapter implements FeedbackAdapterInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws \Sly\NotificationPusher\Exception\PushException
|
||||
* @throws PushException
|
||||
*/
|
||||
public function push(PushInterface $push)
|
||||
{
|
||||
@@ -72,15 +72,14 @@ class Apns extends BaseAdapter implements FeedbackAdapterInterface
|
||||
$pushedDevices = new DeviceCollection();
|
||||
|
||||
foreach ($push->getDevices() as $device) {
|
||||
/** @var \ZendService\Apple\Apns\Message $message */
|
||||
$message = $this->getServiceMessageFromOrigin($device, $push->getMessage());
|
||||
|
||||
try {
|
||||
/** @var \ZendService\Apple\Apns\Response\Message $response */
|
||||
/** @var ServiceResponse $response */
|
||||
$response = $client->send($message);
|
||||
|
||||
$responseArr = [
|
||||
'id' => $response->getId(),
|
||||
'id' => $response->getId(),
|
||||
'token' => $response->getCode(),
|
||||
];
|
||||
$push->addResponse($device, $responseArr);
|
||||
@@ -105,17 +104,15 @@ class Apns extends BaseAdapter implements FeedbackAdapterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Feedback.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getFeedback()
|
||||
{
|
||||
$client = $this->getOpenedFeedbackClient();
|
||||
$responses = [];
|
||||
$client = $this->getOpenedFeedbackClient();
|
||||
$responses = [];
|
||||
$serviceResponses = $client->feedback();
|
||||
|
||||
/** @var \ZendService\Apple\Apns\Response\Feedback $response */
|
||||
/** @var Feedback $response */
|
||||
foreach ($serviceResponses as $response) {
|
||||
$responses[$response->getToken()] = new \DateTime(date('c', $response->getTime()));
|
||||
}
|
||||
@@ -124,11 +121,9 @@ class Apns extends BaseAdapter implements FeedbackAdapterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get opened client.
|
||||
* @param ServiceAbstractClient|null $client Client
|
||||
*
|
||||
* @param \ZendService\Apple\Apns\Client\AbstractClient|null $client Client
|
||||
*
|
||||
* @return \ZendService\Apple\Apns\Client\AbstractClient
|
||||
* @return ServiceAbstractClient
|
||||
*/
|
||||
public function getOpenedClient(ServiceAbstractClient $client = null)
|
||||
{
|
||||
@@ -146,8 +141,6 @@ class Apns extends BaseAdapter implements FeedbackAdapterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get opened ServiceClient
|
||||
*
|
||||
* @return ServiceClient
|
||||
*/
|
||||
protected function getOpenedServiceClient()
|
||||
@@ -160,8 +153,6 @@ class Apns extends BaseAdapter implements FeedbackAdapterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get opened ServiceFeedbackClient
|
||||
*
|
||||
* @return ServiceFeedbackClient
|
||||
*/
|
||||
private function getOpenedFeedbackClient()
|
||||
@@ -174,25 +165,23 @@ class Apns extends BaseAdapter implements FeedbackAdapterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get service message from origin.
|
||||
* @param DeviceInterface $device Device
|
||||
* @param BaseOptionedModel|MessageInterface $message Message
|
||||
*
|
||||
* @param \Sly\NotificationPusher\Model\DeviceInterface $device Device
|
||||
* @param BaseOptionedModel|\Sly\NotificationPusher\Model\MessageInterface $message Message
|
||||
*
|
||||
* @return \ZendService\Apple\Apns\Message
|
||||
* @return ServiceMessage
|
||||
*/
|
||||
public function getServiceMessageFromOrigin(DeviceInterface $device, BaseOptionedModel $message)
|
||||
{
|
||||
$badge = ($message->hasOption('badge'))
|
||||
? (int)($message->getOption('badge') + $device->getParameter('badge', 0))
|
||||
? (int) ($message->getOption('badge') + $device->getParameter('badge', 0))
|
||||
: false;
|
||||
|
||||
$sound = $message->getOption('sound');
|
||||
$sound = $message->getOption('sound');
|
||||
$contentAvailable = $message->getOption('content-available');
|
||||
$mutableContent = $message->getOption('mutable-content');
|
||||
$category = $message->getOption('category');
|
||||
$urlArgs = $message->getOption('urlArgs');
|
||||
$expire = $message->getOption('expire');
|
||||
$mutableContent = $message->getOption('mutable-content');
|
||||
$category = $message->getOption('category');
|
||||
$urlArgs = $message->getOption('urlArgs');
|
||||
$expire = $message->getOption('expire');
|
||||
|
||||
$alert = new ServiceAlert(
|
||||
$message->getText(),
|
||||
@@ -267,7 +256,7 @@ class Apns extends BaseAdapter implements FeedbackAdapterInterface
|
||||
*/
|
||||
public function supports($token)
|
||||
{
|
||||
return (ctype_xdigit($token) && 64 == strlen($token));
|
||||
return ctype_xdigit($token);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -6,27 +6,24 @@
|
||||
* Time: 17:03
|
||||
*/
|
||||
|
||||
namespace Sly\Sly\NotificationPusher\Adapter;
|
||||
namespace Sly\NotificationPusher\Adapter;
|
||||
|
||||
|
||||
use Sly\NotificationPusher\Adapter\BaseAdapter;
|
||||
use Sly\NotificationPusher\Collection\DeviceCollection;
|
||||
use Sly\NotificationPusher\Model\PushInterface;
|
||||
|
||||
/**
|
||||
* Class ApnsAPI
|
||||
* @package Sly\Sly\NotificationPusher\Adapter
|
||||
*
|
||||
* @author Oleg Abrazhaev <seyferseed@gmail.com>
|
||||
* todo: implement with edamov/pushok
|
||||
*/
|
||||
class ApnsAPI extends BaseAdapter
|
||||
{
|
||||
|
||||
/**
|
||||
* Push.
|
||||
* @param PushInterface $push Push
|
||||
*
|
||||
* @param \Sly\NotificationPusher\Model\PushInterface $push Push
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Collection\DeviceCollection
|
||||
* @return DeviceCollection
|
||||
*/
|
||||
public function push(PushInterface $push)
|
||||
{
|
||||
@@ -34,8 +31,6 @@ class ApnsAPI extends BaseAdapter
|
||||
}
|
||||
|
||||
/**
|
||||
* Supports.
|
||||
*
|
||||
* @param string $token Token
|
||||
*
|
||||
* @return boolean
|
||||
@@ -46,8 +41,6 @@ class ApnsAPI extends BaseAdapter
|
||||
}
|
||||
|
||||
/**
|
||||
* Get defined parameters.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDefinedParameters()
|
||||
@@ -56,8 +49,6 @@ class ApnsAPI extends BaseAdapter
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default parameters.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDefaultParameters()
|
||||
@@ -66,12 +57,10 @@ class ApnsAPI extends BaseAdapter
|
||||
}
|
||||
|
||||
/**
|
||||
* Get required parameters.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getRequiredParameters()
|
||||
{
|
||||
// TODO: Implement getRequiredParameters() method.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -18,8 +18,6 @@ use Sly\NotificationPusher\PushManager;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* BaseAdapter.
|
||||
*
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
abstract class BaseAdapter extends BaseParameteredModel implements AdapterInterface
|
||||
@@ -40,8 +38,6 @@ abstract class BaseAdapter extends BaseParameteredModel implements AdapterInterf
|
||||
protected $response;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $parameters Adapter specific parameters
|
||||
*/
|
||||
public function __construct(array $parameters = [])
|
||||
@@ -51,10 +47,10 @@ abstract class BaseAdapter extends BaseParameteredModel implements AdapterInterf
|
||||
$resolver->setDefaults($this->getDefaultParameters());
|
||||
$resolver->setRequired($this->getRequiredParameters());
|
||||
|
||||
$reflectedClass = new \ReflectionClass($this);
|
||||
$reflectedClass = new \ReflectionClass($this);
|
||||
$this->adapterKey = lcfirst($reflectedClass->getShortName());
|
||||
$this->parameters = $resolver->resolve($parameters);
|
||||
$this->response = new Response();
|
||||
$this->response = new Response();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,8 +70,6 @@ abstract class BaseAdapter extends BaseParameteredModel implements AdapterInterf
|
||||
}
|
||||
|
||||
/**
|
||||
* __toString.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
@@ -84,8 +78,6 @@ abstract class BaseAdapter extends BaseParameteredModel implements AdapterInterf
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AdapterKey.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAdapterKey()
|
||||
@@ -94,8 +86,6 @@ abstract class BaseAdapter extends BaseParameteredModel implements AdapterInterf
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Environment.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEnvironment()
|
||||
@@ -104,11 +94,9 @@ abstract class BaseAdapter extends BaseParameteredModel implements AdapterInterf
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Environment.
|
||||
*
|
||||
* @param string $environment Environment value to set
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Adapter\AdapterInterface
|
||||
* @return AdapterInterface
|
||||
*/
|
||||
public function setEnvironment($environment)
|
||||
{
|
||||
@@ -118,8 +106,6 @@ abstract class BaseAdapter extends BaseParameteredModel implements AdapterInterf
|
||||
}
|
||||
|
||||
/**
|
||||
* isDevelopmentEnvironment.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isDevelopmentEnvironment()
|
||||
@@ -128,8 +114,6 @@ abstract class BaseAdapter extends BaseParameteredModel implements AdapterInterf
|
||||
}
|
||||
|
||||
/**
|
||||
* isProductionEnvironment.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isProductionEnvironment()
|
||||
|
@@ -8,8 +8,10 @@
|
||||
|
||||
namespace Sly\NotificationPusher\Adapter;
|
||||
|
||||
|
||||
/**
|
||||
* @author Oleg Abrazhaev <seyferseed@gmail.com>
|
||||
*/
|
||||
interface FeedbackAdapterInterface
|
||||
{
|
||||
public function getFeedback();
|
||||
}
|
||||
}
|
||||
|
@@ -17,16 +17,17 @@ use Sly\NotificationPusher\Exception\PushException;
|
||||
use Sly\NotificationPusher\Model\BaseOptionedModel;
|
||||
use Sly\NotificationPusher\Model\DeviceInterface;
|
||||
use Sly\NotificationPusher\Model\GcmMessage;
|
||||
use Sly\NotificationPusher\Model\MessageInterface;
|
||||
use Sly\NotificationPusher\Model\PushInterface;
|
||||
use Zend\Http\Client as HttpClient;
|
||||
use Zend\Http\Client\Adapter\Socket as HttpSocketAdapter;
|
||||
use ZendService\Google\Exception\InvalidArgumentException as ZendInvalidArgumentException;
|
||||
use ZendService\Google\Exception\RuntimeException as ServiceRuntimeException;
|
||||
use ZendService\Google\Gcm\Client as ServiceClient;
|
||||
use ZendService\Google\Gcm\Message as ServiceMessage;
|
||||
use ZendService\Google\Gcm\Response;
|
||||
|
||||
/**
|
||||
* GCM adapter.
|
||||
*
|
||||
* @uses \Sly\NotificationPusher\Adapter\BaseAdapter
|
||||
*
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
@@ -34,7 +35,7 @@ use ZendService\Google\Gcm\Message as ServiceMessage;
|
||||
class Gcm extends BaseAdapter
|
||||
{
|
||||
/**
|
||||
* @var \Zend\Http\Client
|
||||
* @var HttpClient
|
||||
*/
|
||||
private $httpClient;
|
||||
|
||||
@@ -54,21 +55,21 @@ class Gcm extends BaseAdapter
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws \Sly\NotificationPusher\Exception\PushException
|
||||
* @throws PushException
|
||||
*/
|
||||
public function push(PushInterface $push)
|
||||
{
|
||||
$client = $this->getOpenedClient();
|
||||
$client = $this->getOpenedClient();
|
||||
$pushedDevices = new DeviceCollection();
|
||||
$tokens = array_chunk($push->getDevices()->getTokens(), 100);
|
||||
$tokens = array_chunk($push->getDevices()->getTokens(), 100);
|
||||
|
||||
foreach ($tokens as $tokensRange) {
|
||||
$message = $this->getServiceMessageFromOrigin($tokensRange, $push->getMessage());
|
||||
|
||||
try {
|
||||
|
||||
/** @var \ZendService\Google\Gcm\Response $response */
|
||||
$response = $client->send($message);
|
||||
/** @var Response $response */
|
||||
$response = $client->send($message);
|
||||
$responseResults = $response->getResults();
|
||||
|
||||
foreach ($tokensRange as $token) {
|
||||
@@ -108,7 +109,7 @@ class Gcm extends BaseAdapter
|
||||
/**
|
||||
* Get opened client.
|
||||
*
|
||||
* @return \ZendService\Google\Gcm\Client
|
||||
* @return ServiceClient
|
||||
*/
|
||||
public function getOpenedClient()
|
||||
{
|
||||
@@ -116,10 +117,10 @@ class Gcm extends BaseAdapter
|
||||
$this->openedClient = new ServiceClient();
|
||||
$this->openedClient->setApiKey($this->getParameter('apiKey'));
|
||||
|
||||
$newClient = new \Zend\Http\Client(
|
||||
$newClient = new HttpClient(
|
||||
null,
|
||||
[
|
||||
'adapter' => 'Zend\Http\Client\Adapter\Socket',
|
||||
'adapter' => 'Zend\Http\Client\Adapter\Socket',
|
||||
'sslverifypeer' => false,
|
||||
]
|
||||
);
|
||||
@@ -134,14 +135,14 @@ class Gcm extends BaseAdapter
|
||||
* Get service message from origin.
|
||||
*
|
||||
* @param array $tokens Tokens
|
||||
* @param BaseOptionedModel|\Sly\NotificationPusher\Model\MessageInterface $message Message
|
||||
* @param BaseOptionedModel|MessageInterface $message Message
|
||||
*
|
||||
* @return \ZendService\Google\Gcm\Message
|
||||
* @throws \ZendService\Google\Exception\InvalidArgumentException
|
||||
* @return ServiceMessage
|
||||
* @throws ZendInvalidArgumentException
|
||||
*/
|
||||
public function getServiceMessageFromOrigin(array $tokens, BaseOptionedModel $message)
|
||||
{
|
||||
$data = $message->getOptions();
|
||||
$data = $message->getOptions();
|
||||
$data['message'] = $message->getText();
|
||||
|
||||
$serviceMessage = new ServiceMessage();
|
||||
@@ -159,6 +160,7 @@ class Gcm extends BaseAdapter
|
||||
$serviceMessage->setData($data);
|
||||
|
||||
$serviceMessage->setCollapseKey($this->getParameter('collapseKey'));
|
||||
$serviceMessage->setPriority($this->getParameter('priority', 'normal'));
|
||||
$serviceMessage->setRestrictedPackageName($this->getParameter('restrictedPackageName'));
|
||||
$serviceMessage->setDelayWhileIdle($this->getParameter('delayWhileIdle', false));
|
||||
$serviceMessage->setTimeToLive($this->getParameter('ttl', 600));
|
||||
@@ -174,6 +176,7 @@ class Gcm extends BaseAdapter
|
||||
{
|
||||
return [
|
||||
'collapseKey',
|
||||
'priority',
|
||||
'delayWhileIdle',
|
||||
'ttl',
|
||||
'restrictedPackageName',
|
||||
@@ -222,7 +225,7 @@ class Gcm extends BaseAdapter
|
||||
*
|
||||
* @param array $config
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function setAdapterParameters(array $config = [])
|
||||
{
|
||||
|
@@ -17,10 +17,8 @@ use Sly\NotificationPusher\Model\ResponseInterface;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
/**
|
||||
* Facade for simple use cases
|
||||
*
|
||||
* Class ApnsPushService
|
||||
* @package Sly\NotificationPusher
|
||||
* @author Oleg Abrazhaev <seyferseed@gmail.com>
|
||||
*/
|
||||
class ApnsPushService extends AbstractPushService
|
||||
{
|
||||
@@ -50,7 +48,7 @@ class ApnsPushService extends AbstractPushService
|
||||
parent::__construct($environment);
|
||||
|
||||
$this->certificatePath = $certificatePath;
|
||||
$this->passPhrase = $passPhrase;
|
||||
$this->passPhrase = $passPhrase;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,7 +73,7 @@ class ApnsPushService extends AbstractPushService
|
||||
}
|
||||
|
||||
$adapterParams = [];
|
||||
$deviceParams = [];
|
||||
$deviceParams = [];
|
||||
$messageParams = [];
|
||||
if (isset($params) && !empty($params)) {
|
||||
if (isset($params['adapter'])) {
|
||||
@@ -92,10 +90,9 @@ class ApnsPushService extends AbstractPushService
|
||||
}
|
||||
|
||||
$adapterParams['certificate'] = $this->certificatePath;
|
||||
$adapterParams['passPhrase'] = $this->passPhrase;
|
||||
$adapterParams['passPhrase'] = $this->passPhrase;
|
||||
|
||||
// Development one by default (without argument).
|
||||
/** @var PushManager $pushManager */
|
||||
$pushManager = new PushManager($this->environment);
|
||||
|
||||
// Then declare an adapter.
|
||||
@@ -135,9 +132,9 @@ class ApnsPushService extends AbstractPushService
|
||||
*/
|
||||
public function feedback()
|
||||
{
|
||||
$adapterParams = [];
|
||||
$adapterParams = [];
|
||||
$adapterParams['certificate'] = $this->certificatePath;
|
||||
$adapterParams['passPhrase'] = $this->passPhrase;
|
||||
$adapterParams['passPhrase'] = $this->passPhrase;
|
||||
|
||||
// Development one by default (without argument).
|
||||
/** @var PushManager $pushManager */
|
||||
@@ -201,7 +198,7 @@ class ApnsPushService extends AbstractPushService
|
||||
}
|
||||
|
||||
$feedbackTokens = array_keys($this->feedback);
|
||||
$sentTokens = array_keys($this->response->getParsedResponses());
|
||||
$sentTokens = array_keys($this->response->getParsedResponses());
|
||||
|
||||
//all bad
|
||||
if (!$feedbackTokens) {
|
||||
|
@@ -11,31 +11,33 @@
|
||||
|
||||
namespace Sly\NotificationPusher\Collection;
|
||||
|
||||
use ArrayIterator;
|
||||
use Countable;
|
||||
use IteratorAggregate;
|
||||
use SeekableIterator;
|
||||
use Sly\NotificationPusher\Model\MessageInterface;
|
||||
|
||||
/**
|
||||
* AbstractCollection.
|
||||
*
|
||||
* @uses \IteratorAggregate
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
abstract class AbstractCollection implements \IteratorAggregate, \Countable
|
||||
abstract class AbstractCollection implements IteratorAggregate, Countable
|
||||
{
|
||||
/**
|
||||
* @var \ArrayIterator
|
||||
* @var ArrayIterator
|
||||
*/
|
||||
protected $coll;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return \ArrayIterator|\SeekableIterator
|
||||
* @return ArrayIterator|SeekableIterator
|
||||
*/
|
||||
abstract public function getIterator();
|
||||
|
||||
/**
|
||||
* Get.
|
||||
*
|
||||
* @param string $key Key
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Model\MessageInterface|false
|
||||
* @return MessageInterface|false
|
||||
*/
|
||||
public function get($key)
|
||||
{
|
||||
@@ -43,8 +45,6 @@ abstract class AbstractCollection implements \IteratorAggregate, \Countable
|
||||
}
|
||||
|
||||
/**
|
||||
* Count.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function count()
|
||||
@@ -53,8 +53,6 @@ abstract class AbstractCollection implements \IteratorAggregate, \Countable
|
||||
}
|
||||
|
||||
/**
|
||||
* isEmpty.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isEmpty()
|
||||
@@ -67,7 +65,7 @@ abstract class AbstractCollection implements \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->coll = new \ArrayIterator();
|
||||
$this->coll = new ArrayIterator();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -14,17 +14,13 @@ namespace Sly\NotificationPusher\Collection;
|
||||
use Sly\NotificationPusher\Model\DeviceInterface;
|
||||
|
||||
/**
|
||||
* DeviceCollection.
|
||||
*
|
||||
* @uses \Sly\NotificationPusher\Collection\AbstractCollection
|
||||
* @uses \IteratorAggregate
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
class DeviceCollection extends AbstractCollection implements \IteratorAggregate
|
||||
class DeviceCollection extends AbstractCollection
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $devices Devices
|
||||
*/
|
||||
public function __construct(array $devices = [])
|
||||
@@ -45,7 +41,7 @@ class DeviceCollection extends AbstractCollection implements \IteratorAggregate
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Sly\NotificationPusher\Model\DeviceInterface $device Device
|
||||
* @param DeviceInterface $device Device
|
||||
*/
|
||||
public function add(DeviceInterface $device)
|
||||
{
|
||||
@@ -53,8 +49,6 @@ class DeviceCollection extends AbstractCollection implements \IteratorAggregate
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tokens.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTokens()
|
||||
|
@@ -14,17 +14,12 @@ namespace Sly\NotificationPusher\Collection;
|
||||
use Sly\NotificationPusher\Model\MessageInterface;
|
||||
|
||||
/**
|
||||
* MessageCollection.
|
||||
*
|
||||
* @uses \Sly\NotificationPusher\Collection\AbstractCollection
|
||||
* @uses \IteratorAggregate
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
class MessageCollection extends AbstractCollection implements \IteratorAggregate
|
||||
class MessageCollection extends AbstractCollection
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->coll = new \ArrayIterator();
|
||||
@@ -39,7 +34,7 @@ class MessageCollection extends AbstractCollection implements \IteratorAggregate
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Sly\NotificationPusher\Model\MessageInterface $message Message
|
||||
* @param MessageInterface $message Message
|
||||
*/
|
||||
public function add(MessageInterface $message)
|
||||
{
|
||||
|
@@ -14,17 +14,12 @@ namespace Sly\NotificationPusher\Collection;
|
||||
use Sly\NotificationPusher\Model\PushInterface;
|
||||
|
||||
/**
|
||||
* PushCollection.
|
||||
*
|
||||
* @uses \Sly\NotificationPusher\Collection\AbstractCollection
|
||||
* @uses \IteratorAggregate
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
class PushCollection extends AbstractCollection
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->coll = new \ArrayIterator();
|
||||
@@ -39,7 +34,7 @@ class PushCollection extends AbstractCollection
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Sly\NotificationPusher\Model\PushInterface $push Push
|
||||
* @param PushInterface $push Push
|
||||
*/
|
||||
public function add(PushInterface $push)
|
||||
{
|
||||
|
@@ -22,9 +22,6 @@ namespace Sly\NotificationPusher\Collection;
|
||||
*/
|
||||
class ResponseCollection extends AbstractCollection
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->coll = new \ArrayIterator();
|
||||
|
@@ -16,16 +16,11 @@ use Sly\NotificationPusher\NotificationPusher;
|
||||
use Symfony\Component\Console\Application as BaseApplication;
|
||||
|
||||
/**
|
||||
* Application.
|
||||
*
|
||||
* @uses \Symfony\Component\Console\Application
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
class Application extends BaseApplication
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
error_reporting(-1);
|
||||
|
@@ -12,6 +12,8 @@
|
||||
namespace Sly\NotificationPusher\Console\Command;
|
||||
|
||||
use Doctrine\Common\Inflector\Inflector;
|
||||
use Exception;
|
||||
use Sly\NotificationPusher\Adapter\AdapterInterface;
|
||||
use Sly\NotificationPusher\Exception\AdapterException;
|
||||
use Sly\NotificationPusher\Model\Device;
|
||||
use Sly\NotificationPusher\Model\Message;
|
||||
@@ -24,8 +26,6 @@ use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* PushCommand.
|
||||
*
|
||||
* @uses \Symfony\Component\Console\Command\Command
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
@@ -85,18 +85,16 @@ class PushCommand extends Command
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$adapter = $this->getReadyAdapter($input, $output);
|
||||
$adapter = $this->getReadyAdapter($input, $output);
|
||||
$pushManager = new PushManager($input->getOption('env'));
|
||||
$message = new Message($input->getArgument('message'));
|
||||
$push = new Push($adapter, new Device($input->getArgument('token')), $message);
|
||||
$message = new Message($input->getArgument('message'));
|
||||
$push = new Push($adapter, new Device($input->getArgument('token')), $message);
|
||||
$pushManager->add($push);
|
||||
|
||||
$pushManager->push();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get adapter class from argument.
|
||||
*
|
||||
* @param string $argument Given argument
|
||||
*
|
||||
* @return string
|
||||
@@ -121,7 +119,7 @@ class PushCommand extends Command
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Adapter\AdapterInterface
|
||||
* @return AdapterInterface
|
||||
*/
|
||||
private function getReadyAdapter(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
@@ -129,13 +127,13 @@ class PushCommand extends Command
|
||||
|
||||
try {
|
||||
$adapter = new $adapterClass();
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$adapterData = [];
|
||||
preg_match_all('/"(.*)"/i', $e->getMessage(), $matches);
|
||||
|
||||
foreach ($matches[1] as $match) {
|
||||
$optionKey = str_replace('_', '-', Inflector::tableize($match));
|
||||
$option = $input->getOption($optionKey);
|
||||
$option = $input->getOption($optionKey);
|
||||
|
||||
if (!$option) {
|
||||
throw new AdapterException(
|
||||
|
@@ -12,8 +12,6 @@
|
||||
namespace Sly\NotificationPusher\Exception;
|
||||
|
||||
/**
|
||||
* AdapterException.
|
||||
*
|
||||
* @uses \RuntimeException
|
||||
* @uses \Sly\NotificationPusher\Exception\ExceptionInterface
|
||||
*
|
||||
|
@@ -12,8 +12,6 @@
|
||||
namespace Sly\NotificationPusher\Exception;
|
||||
|
||||
/**
|
||||
* ExceptionInterface.
|
||||
*
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
interface ExceptionInterface
|
||||
|
@@ -12,8 +12,6 @@
|
||||
namespace Sly\NotificationPusher\Exception;
|
||||
|
||||
/**
|
||||
* InvalidException.
|
||||
*
|
||||
* @uses \RuntimeException
|
||||
* @uses \Sly\NotificationPusher\Exception\ExceptionInterface
|
||||
*
|
||||
|
@@ -12,8 +12,6 @@
|
||||
namespace Sly\NotificationPusher\Exception;
|
||||
|
||||
/**
|
||||
* PushException.
|
||||
*
|
||||
* @uses \RuntimeException
|
||||
* @uses \Sly\NotificationPusher\Exception\ExceptionInterface
|
||||
*
|
||||
|
@@ -12,8 +12,6 @@
|
||||
namespace Sly\NotificationPusher\Exception;
|
||||
|
||||
/**
|
||||
* RuntimeException.
|
||||
*
|
||||
* @uses \RuntimeException
|
||||
* @uses \Sly\NotificationPusher\Exception\ExceptionInterface
|
||||
*
|
||||
|
@@ -20,6 +20,7 @@ use Sly\NotificationPusher\Model\ResponseInterface;
|
||||
*
|
||||
* Class GcmPushService
|
||||
* @package Sly\NotificationPusher
|
||||
* @author Oleg Abrazhaev <seyferseed@gmail.com>
|
||||
*/
|
||||
class GcmPushService extends AbstractPushService
|
||||
{
|
||||
@@ -29,7 +30,6 @@ class GcmPushService extends AbstractPushService
|
||||
private $apiKey = '';
|
||||
|
||||
/**
|
||||
* GcmPushService constructor.
|
||||
* @param string $environment
|
||||
* @param string $apiKey
|
||||
*/
|
||||
@@ -58,7 +58,7 @@ class GcmPushService extends AbstractPushService
|
||||
}
|
||||
|
||||
$adapterParams = [];
|
||||
$deviceParams = [];
|
||||
$deviceParams = [];
|
||||
$messageParams = [];
|
||||
if (isset($params) && !empty($params)) {
|
||||
if (isset($params['adapter'])) {
|
||||
@@ -86,7 +86,6 @@ class GcmPushService extends AbstractPushService
|
||||
}
|
||||
|
||||
// Development one by default (without argument).
|
||||
/** @var PushManager $pushManager */
|
||||
$pushManager = new PushManager($this->environment);
|
||||
|
||||
// Then declare an adapter.
|
||||
@@ -130,7 +129,7 @@ class GcmPushService extends AbstractPushService
|
||||
|
||||
foreach ($this->response->getParsedResponses() as $token => $response) {
|
||||
if (array_key_exists('error', $response) && !array_key_exists('message_id', $response)) {
|
||||
array_push($tokens, $token);
|
||||
$tokens[] = $token;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +149,7 @@ class GcmPushService extends AbstractPushService
|
||||
|
||||
foreach ($this->response->getParsedResponses() as $token => $response) {
|
||||
if (!array_key_exists('error', $response) && array_key_exists('message_id', $response)) {
|
||||
array_push($tokens, $token);
|
||||
$tokens[] = $token;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -12,8 +12,6 @@
|
||||
namespace Sly\NotificationPusher\Model;
|
||||
|
||||
/**
|
||||
* BaseOptionedModel.
|
||||
*
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
abstract class BaseOptionedModel
|
||||
@@ -24,8 +22,6 @@ abstract class BaseOptionedModel
|
||||
protected $options = [];
|
||||
|
||||
/**
|
||||
* Get options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
@@ -34,8 +30,6 @@ abstract class BaseOptionedModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Has option.
|
||||
*
|
||||
* @param string $key Key
|
||||
*
|
||||
* @return boolean
|
||||
@@ -46,8 +40,6 @@ abstract class BaseOptionedModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get option.
|
||||
*
|
||||
* @param string $key Key
|
||||
* @param mixed $default Default
|
||||
*
|
||||
@@ -59,11 +51,9 @@ abstract class BaseOptionedModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set options.
|
||||
*
|
||||
* @param array $options Options
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Model\BaseOptionedModel
|
||||
* @return BaseOptionedModel
|
||||
*/
|
||||
public function setOptions($options)
|
||||
{
|
||||
@@ -73,8 +63,6 @@ abstract class BaseOptionedModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set option.
|
||||
*
|
||||
* @param string $key Key
|
||||
* @param mixed $value Value
|
||||
*
|
||||
|
@@ -12,8 +12,6 @@
|
||||
namespace Sly\NotificationPusher\Model;
|
||||
|
||||
/**
|
||||
* BaseParameteredModel.
|
||||
*
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
abstract class BaseParameteredModel
|
||||
@@ -24,8 +22,6 @@ abstract class BaseParameteredModel
|
||||
protected $parameters = [];
|
||||
|
||||
/**
|
||||
* Get parameters.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getParameters()
|
||||
@@ -34,8 +30,6 @@ abstract class BaseParameteredModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Has parameter.
|
||||
*
|
||||
* @param string $key Key
|
||||
*
|
||||
* @return boolean
|
||||
@@ -46,8 +40,6 @@ abstract class BaseParameteredModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parameter.
|
||||
*
|
||||
* @param string $key Key
|
||||
* @param mixed $default Default
|
||||
*
|
||||
@@ -59,11 +51,9 @@ abstract class BaseParameteredModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set parameters.
|
||||
*
|
||||
* @param array $parameters Parameters
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Model\BaseParameteredModel
|
||||
* @return BaseParameteredModel
|
||||
*/
|
||||
public function setParameters($parameters)
|
||||
{
|
||||
@@ -73,8 +63,6 @@ abstract class BaseParameteredModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set parameter.
|
||||
*
|
||||
* @param string $key Key
|
||||
* @param mixed $value Value
|
||||
*
|
||||
|
@@ -12,8 +12,6 @@
|
||||
namespace Sly\NotificationPusher\Model;
|
||||
|
||||
/**
|
||||
* Device.
|
||||
*
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
class Device extends BaseParameteredModel implements DeviceInterface
|
||||
@@ -24,20 +22,16 @@ class Device extends BaseParameteredModel implements DeviceInterface
|
||||
private $token;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $token Token
|
||||
* @param array $parameters Parameters
|
||||
*/
|
||||
public function __construct($token, array $parameters = [])
|
||||
{
|
||||
$this->token = $token;
|
||||
$this->token = $token;
|
||||
$this->parameters = $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get token.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getToken()
|
||||
@@ -46,11 +40,9 @@ class Device extends BaseParameteredModel implements DeviceInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Set token.
|
||||
*
|
||||
* @param string $token Token
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Model\DeviceInterface
|
||||
* @return DeviceInterface
|
||||
*/
|
||||
public function setToken($token)
|
||||
{
|
||||
|
@@ -12,25 +12,19 @@
|
||||
namespace Sly\NotificationPusher\Model;
|
||||
|
||||
/**
|
||||
* DeviceInterface
|
||||
*
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
interface DeviceInterface
|
||||
{
|
||||
/**
|
||||
* Get token.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getToken();
|
||||
|
||||
/**
|
||||
* Set token.
|
||||
*
|
||||
* @param string $token Token
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Model\DeviceInterface
|
||||
* @return DeviceInterface
|
||||
*/
|
||||
public function setToken($token);
|
||||
}
|
||||
|
@@ -12,8 +12,6 @@
|
||||
namespace Sly\NotificationPusher\Model;
|
||||
|
||||
/**
|
||||
* Message.
|
||||
*
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
class Message extends BaseOptionedModel implements MessageInterface
|
||||
@@ -24,20 +22,16 @@ class Message extends BaseOptionedModel implements MessageInterface
|
||||
protected $text;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $text Text
|
||||
* @param array $options Options
|
||||
*/
|
||||
public function __construct($text, array $options = [])
|
||||
{
|
||||
$this->text = $text;
|
||||
$this->text = $text;
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Text.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
@@ -46,11 +40,9 @@ class Message extends BaseOptionedModel implements MessageInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Text.
|
||||
*
|
||||
* @param string $text Text
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Model\MessageInterface
|
||||
* @return MessageInterface
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
|
@@ -12,25 +12,19 @@
|
||||
namespace Sly\NotificationPusher\Model;
|
||||
|
||||
/**
|
||||
* MessageInterface
|
||||
*
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
interface MessageInterface
|
||||
{
|
||||
/**
|
||||
* Get Text.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText();
|
||||
|
||||
/**
|
||||
* Set Text.
|
||||
*
|
||||
* @param string $text Text
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Model\MessageInterface
|
||||
* @return MessageInterface
|
||||
*/
|
||||
public function setText($text);
|
||||
}
|
||||
|
@@ -17,8 +17,6 @@ use Sly\NotificationPusher\Collection\ResponseCollection;
|
||||
use Sly\NotificationPusher\Exception\AdapterException;
|
||||
|
||||
/**
|
||||
* Push.
|
||||
*
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
class Push extends BaseOptionedModel implements PushInterface
|
||||
@@ -30,17 +28,17 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
private $status;
|
||||
|
||||
/**
|
||||
* @var \Sly\NotificationPusher\Adapter\AdapterInterface
|
||||
* @var AdapterInterface
|
||||
*/
|
||||
private $adapter;
|
||||
|
||||
/**
|
||||
* @var \Sly\NotificationPusher\Model\MessageInterface
|
||||
* @var MessageInterface
|
||||
*/
|
||||
private $message;
|
||||
|
||||
/**
|
||||
* @var \Sly\NotificationPusher\Collection\DeviceCollection
|
||||
* @var DeviceCollection
|
||||
*/
|
||||
private $devices;
|
||||
|
||||
@@ -50,22 +48,20 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
private $pushedAt;
|
||||
|
||||
/**
|
||||
* @var \Sly\NotificationPusher\Collection\ResponseCollection
|
||||
* @var ResponseCollection
|
||||
*/
|
||||
private $responses;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Sly\NotificationPusher\Adapter\AdapterInterface $adapter Adapter
|
||||
* @param AdapterInterface $adapter Adapter
|
||||
* @param DeviceInterface|DeviceCollection $devices Device(s)
|
||||
* @param \Sly\NotificationPusher\Model\MessageInterface $message Message
|
||||
* @param MessageInterface $message Message
|
||||
* @param array $options Options
|
||||
*
|
||||
* Options are adapters specific ones, like Apns "badge" or "sound" option for example.
|
||||
* Of course, they can be more general.
|
||||
*
|
||||
* @throws \Sly\NotificationPusher\Exception\AdapterException
|
||||
* @throws AdapterException
|
||||
*/
|
||||
public function __construct(AdapterInterface $adapter, $devices, MessageInterface $message, array $options = [])
|
||||
{
|
||||
@@ -77,14 +73,13 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
$this->devices = $devices;
|
||||
$this->message = $message;
|
||||
$this->options = $options;
|
||||
$this->status = self::STATUS_PENDING;
|
||||
$this->status = self::STATUS_PENDING;
|
||||
|
||||
$this->checkDevicesTokens();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check devices tokens.
|
||||
* @throws \Sly\NotificationPusher\Exception\AdapterException
|
||||
* @throws AdapterException
|
||||
*/
|
||||
private function checkDevicesTokens()
|
||||
{
|
||||
@@ -96,7 +91,7 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
throw new AdapterException(
|
||||
sprintf(
|
||||
'Adapter %s does not support %s token\'s device',
|
||||
(string)$adapter,
|
||||
(string) $adapter,
|
||||
$device->getToken()
|
||||
)
|
||||
);
|
||||
@@ -105,8 +100,6 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Status.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStatus()
|
||||
@@ -115,11 +108,9 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Status.
|
||||
*
|
||||
* @param string $status Status
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Model\PushInterface
|
||||
* @return PushInterface
|
||||
*/
|
||||
public function setStatus($status)
|
||||
{
|
||||
@@ -129,32 +120,26 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* isPushed.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPushed()
|
||||
{
|
||||
return (bool)(self::STATUS_PUSHED === $this->status);
|
||||
return (bool) (self::STATUS_PUSHED === $this->status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Declare as pushed.
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Model\PushInterface
|
||||
* @return PushInterface
|
||||
*/
|
||||
public function pushed()
|
||||
{
|
||||
$this->status = self::STATUS_PUSHED;
|
||||
$this->status = self::STATUS_PUSHED;
|
||||
$this->pushedAt = new \DateTime();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Adapter.
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Adapter\AdapterInterface
|
||||
* @return AdapterInterface
|
||||
*/
|
||||
public function getAdapter()
|
||||
{
|
||||
@@ -162,11 +147,9 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Adapter.
|
||||
* @param AdapterInterface $adapter Adapter
|
||||
*
|
||||
* @param \Sly\NotificationPusher\Adapter\AdapterInterface $adapter Adapter
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Model\PushInterface
|
||||
* @return PushInterface
|
||||
*/
|
||||
public function setAdapter(AdapterInterface $adapter)
|
||||
{
|
||||
@@ -176,9 +159,7 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Message.
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Model\MessageInterface
|
||||
* @return MessageInterface
|
||||
*/
|
||||
public function getMessage()
|
||||
{
|
||||
@@ -186,11 +167,9 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Message.
|
||||
* @param MessageInterface $message Message
|
||||
*
|
||||
* @param \Sly\NotificationPusher\Model\MessageInterface $message Message
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Model\PushInterface
|
||||
* @return PushInterface
|
||||
*/
|
||||
public function setMessage(MessageInterface $message)
|
||||
{
|
||||
@@ -200,9 +179,7 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Devices.
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Collection\DeviceCollection
|
||||
* @return DeviceCollection
|
||||
*/
|
||||
public function getDevices()
|
||||
{
|
||||
@@ -210,11 +187,9 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Devices.
|
||||
* @param DeviceCollection $devices Devices
|
||||
*
|
||||
* @param \Sly\NotificationPusher\Collection\DeviceCollection $devices Devices
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Model\PushInterface
|
||||
* @return PushInterface
|
||||
*/
|
||||
public function setDevices(DeviceCollection $devices)
|
||||
{
|
||||
@@ -226,8 +201,7 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Responses
|
||||
* @return \Sly\NotificationPusher\Collection\ResponseCollection
|
||||
* @return ResponseCollection
|
||||
*/
|
||||
public function getResponses()
|
||||
{
|
||||
@@ -238,8 +212,7 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* adds a response
|
||||
* @param \Sly\NotificationPusher\Model\DeviceInterface $device
|
||||
* @param DeviceInterface $device
|
||||
* @param mixed $response
|
||||
*/
|
||||
public function addResponse(DeviceInterface $device, $response)
|
||||
@@ -248,8 +221,6 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get PushedAt.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getPushedAt()
|
||||
@@ -258,11 +229,9 @@ class Push extends BaseOptionedModel implements PushInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Set PushedAt.
|
||||
*
|
||||
* @param \DateTime $pushedAt PushedAt
|
||||
*
|
||||
* @return \Sly\NotificationPusher\Model\PushInterface
|
||||
* @return PushInterface
|
||||
*/
|
||||
public function setPushedAt(\DateTime $pushedAt)
|
||||
{
|
||||
|
@@ -14,28 +14,22 @@ namespace Sly\NotificationPusher\Model;
|
||||
use DateTime;
|
||||
use Sly\NotificationPusher\Adapter\AdapterInterface;
|
||||
use Sly\NotificationPusher\Collection\DeviceCollection;
|
||||
use Sly\NotificationPusher\Collection\ResponseCollection;
|
||||
|
||||
/**
|
||||
* PushInterface
|
||||
*/
|
||||
interface PushInterface
|
||||
{
|
||||
/**
|
||||
* Constants define available statuses
|
||||
*/
|
||||
const STATUS_PENDING = 'pending';
|
||||
const STATUS_PUSHED = 'sent';
|
||||
const STATUS_PUSHED = 'sent';
|
||||
|
||||
/**
|
||||
* Get Status.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStatus();
|
||||
|
||||
/**
|
||||
* Set Status.
|
||||
*
|
||||
* @param string $status Status
|
||||
*
|
||||
* @return PushInterface
|
||||
@@ -43,29 +37,21 @@ interface PushInterface
|
||||
public function setStatus($status);
|
||||
|
||||
/**
|
||||
* isPushed.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPushed();
|
||||
|
||||
/**
|
||||
* Declare as pushed.
|
||||
*
|
||||
* @return PushInterface
|
||||
*/
|
||||
public function pushed();
|
||||
|
||||
/**
|
||||
* Get Adapter.
|
||||
*
|
||||
* @return AdapterInterface
|
||||
*/
|
||||
public function getAdapter();
|
||||
|
||||
/**
|
||||
* Set Adapter.
|
||||
*
|
||||
* @param AdapterInterface $adapter Adapter
|
||||
*
|
||||
* @return PushInterface
|
||||
@@ -73,15 +59,11 @@ interface PushInterface
|
||||
public function setAdapter(AdapterInterface $adapter);
|
||||
|
||||
/**
|
||||
* Get Message.
|
||||
*
|
||||
* @return MessageInterface
|
||||
*/
|
||||
public function getMessage();
|
||||
|
||||
/**
|
||||
* Set Message.
|
||||
*
|
||||
* @param MessageInterface $message Message
|
||||
*
|
||||
* @return PushInterface
|
||||
@@ -89,15 +71,11 @@ interface PushInterface
|
||||
public function setMessage(MessageInterface $message);
|
||||
|
||||
/**
|
||||
* Get Devices.
|
||||
*
|
||||
* @return DeviceCollection
|
||||
*/
|
||||
public function getDevices();
|
||||
|
||||
/**
|
||||
* Set Devices.
|
||||
*
|
||||
* @param DeviceCollection $devices Devices
|
||||
*
|
||||
* @return PushInterface
|
||||
@@ -105,28 +83,22 @@ interface PushInterface
|
||||
public function setDevices(DeviceCollection $devices);
|
||||
|
||||
/**
|
||||
* Get Responses
|
||||
* @return \Sly\NotificationPusher\Collection\ResponseCollection
|
||||
* @return ResponseCollection
|
||||
*/
|
||||
public function getResponses();
|
||||
|
||||
/**
|
||||
* adds a response
|
||||
* @param \Sly\NotificationPusher\Model\DeviceInterface $device
|
||||
* @param DeviceInterface $device
|
||||
* @param mixed $response
|
||||
*/
|
||||
public function addResponse(DeviceInterface $device, $response);
|
||||
|
||||
/**
|
||||
* Get PushedAt.
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getPushedAt();
|
||||
|
||||
/**
|
||||
* Set PushedAt.
|
||||
*
|
||||
* @param DateTime $pushedAt PushedAt
|
||||
*
|
||||
* @return PushInterface
|
||||
|
@@ -11,6 +11,9 @@ namespace Sly\NotificationPusher\Model;
|
||||
|
||||
use Sly\NotificationPusher\Collection\PushCollection;
|
||||
|
||||
/**
|
||||
* @author Oleg Abrazhaev <seyferseed@gmail.com>
|
||||
*/
|
||||
class Response implements ResponseInterface
|
||||
{
|
||||
/**
|
||||
@@ -28,9 +31,6 @@ class Response implements ResponseInterface
|
||||
*/
|
||||
private $pushCollection;
|
||||
|
||||
/**
|
||||
* Response constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->pushCollection = new PushCollection();
|
||||
@@ -59,7 +59,7 @@ class Response implements ResponseInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Sly\NotificationPusher\Model\PushInterface $push Push
|
||||
* @param PushInterface $push Push
|
||||
*/
|
||||
public function addPush(PushInterface $push)
|
||||
{
|
||||
@@ -89,4 +89,4 @@ class Response implements ResponseInterface
|
||||
{
|
||||
return $this->pushCollection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,9 @@ namespace Sly\NotificationPusher\Model;
|
||||
|
||||
use Sly\NotificationPusher\Collection\PushCollection;
|
||||
|
||||
/**
|
||||
* @author Oleg Abrazhaev <seyferseed@gmail.com>
|
||||
*/
|
||||
interface ResponseInterface
|
||||
{
|
||||
/**
|
||||
@@ -25,7 +28,7 @@ interface ResponseInterface
|
||||
public function addOriginalResponse(DeviceInterface $device, $originalResponse);
|
||||
|
||||
/**
|
||||
* @param \Sly\NotificationPusher\Model\PushInterface $push Push
|
||||
* @param PushInterface $push Push
|
||||
*/
|
||||
public function addPush(PushInterface $push);
|
||||
|
||||
@@ -43,4 +46,4 @@ interface ResponseInterface
|
||||
* @return PushCollection
|
||||
*/
|
||||
public function getPushCollection();
|
||||
}
|
||||
}
|
||||
|
@@ -11,9 +11,6 @@
|
||||
|
||||
namespace Sly\NotificationPusher;
|
||||
|
||||
/**
|
||||
* NotificationPusher.
|
||||
*/
|
||||
class NotificationPusher
|
||||
{
|
||||
const VERSION = '2.0';
|
||||
|
@@ -20,14 +20,12 @@ use Sly\NotificationPusher\Model\PushInterface;
|
||||
use Sly\NotificationPusher\Model\ResponseInterface;
|
||||
|
||||
/**
|
||||
* PushManager.
|
||||
*
|
||||
* @uses \Sly\NotificationPusher\Collection\PushCollection
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
class PushManager
|
||||
{
|
||||
const ENVIRONMENT_DEV = 'dev';
|
||||
const ENVIRONMENT_DEV = 'dev';
|
||||
const ENVIRONMENT_PROD = 'prod';
|
||||
|
||||
/**
|
||||
@@ -46,18 +44,16 @@ class PushManager
|
||||
private $response;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $environment Environment
|
||||
*/
|
||||
public function __construct($environment = self::ENVIRONMENT_DEV)
|
||||
{
|
||||
$this->environment = $environment;
|
||||
$this->environment = $environment;
|
||||
$this->pushCollection = new PushCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Sly\NotificationPusher\Model\PushInterface $push Push
|
||||
* @param PushInterface $push Push
|
||||
*/
|
||||
public function add(PushInterface $push)
|
||||
{
|
||||
@@ -65,8 +61,6 @@ class PushManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Get environment.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEnvironment()
|
||||
@@ -75,8 +69,6 @@ class PushManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Push.
|
||||
*
|
||||
* @return PushCollection
|
||||
*/
|
||||
public function push()
|
||||
@@ -93,17 +85,15 @@ class PushManager
|
||||
|
||||
if ($this->pushCollection && !$this->pushCollection->isEmpty()) {
|
||||
/** @var Push $push */
|
||||
$push = $this->pushCollection->first();
|
||||
$push = $this->pushCollection->first();
|
||||
$this->response = $push->getAdapter()->getResponse();
|
||||
}
|
||||
|
||||
|
||||
return $this->pushCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get feedback.
|
||||
*
|
||||
* @param \Sly\NotificationPusher\Adapter\AdapterInterface $adapter Adapter
|
||||
* @param AdapterInterface $adapter Adapter
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
@@ -115,7 +105,7 @@ class PushManager
|
||||
throw new AdapterException(
|
||||
sprintf(
|
||||
'%s adapter has no dedicated "getFeedback" method',
|
||||
(string)$adapter
|
||||
(string) $adapter
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@@ -4,207 +4,192 @@ namespace tests\units\Sly\NotificationPusher\Adapter;
|
||||
|
||||
use mageekguy\atoum as Units;
|
||||
use Sly\NotificationPusher\Adapter\Apns as TestedModel;
|
||||
use Sly\NotificationPusher\Collection\DeviceCollection as BaseDeviceCollection;
|
||||
use Sly\NotificationPusher\Collection\DeviceCollection;
|
||||
use Sly\NotificationPusher\Model\Device as BaseDevice;
|
||||
use Sly\NotificationPusher\Model\Message as BaseMessage;
|
||||
use Sly\NotificationPusher\Exception\AdapterException;
|
||||
use Sly\NotificationPusher\Model\Device;
|
||||
use Sly\NotificationPusher\Model\Message;
|
||||
use Sly\NotificationPusher\Model\Push;
|
||||
use Sly\NotificationPusher\Model\Response;
|
||||
use ZendService\Apple\Apns\Client\Message as BaseServiceClient;
|
||||
use ZendService\Apple\Apns\Message as BaseServiceMessage;
|
||||
use Symfony\Component\OptionsResolver\Exception\MissingOptionsException;
|
||||
use ZendService\Apple\Apns\Client\Feedback;
|
||||
use ZendService\Apple\Apns\Client\Message as ZendClientMessage;
|
||||
use ZendService\Apple\Apns\Message as ZendServiceMessage;
|
||||
use ZendService\Apple\Apns\Response\Message as ZendResponseMessage;
|
||||
use ZendService\Apple\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Apns.
|
||||
*
|
||||
* @uses atoum\test
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
class Apns extends Units\Test
|
||||
{
|
||||
const APNS_TOKEN_EXAMPLE = '111db24975bb6c6b63214a8d268052aa0a965cc1e32110ab06a72b19074c2222';
|
||||
const APNS_TOKEN_EXAMPLE_64 = '111db24975bb6c6b63214a8d268052aa0a965cc1e32110ab06a72b19074c2222';
|
||||
const APNS_TOKEN_EXAMPLE_65 = '111db24975bb6c6b63214a8d268052aa0a965cc1e32110ab06a72b19074c22225';
|
||||
|
||||
public function testConstruct()
|
||||
{
|
||||
$this
|
||||
->exception(function() {
|
||||
->exception(static function () {
|
||||
$object = new TestedModel();
|
||||
})
|
||||
->isInstanceOf('\Symfony\Component\OptionsResolver\Exception\MissingOptionsException')
|
||||
->message
|
||||
->contains('certificate')
|
||||
->exception(function() {
|
||||
->isInstanceOf(MissingOptionsException::class)
|
||||
->message
|
||||
->contains('certificate')
|
||||
->exception(static function () {
|
||||
$object = new TestedModel(['certificate' => 'absent.pem']);
|
||||
})
|
||||
->isInstanceOf('\Sly\NotificationPusher\Exception\AdapterException')
|
||||
->message
|
||||
->contains('does not exist')
|
||||
|
||||
->isInstanceOf(AdapterException::class)
|
||||
->message
|
||||
->contains('does not exist')
|
||||
->when($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Apns())
|
||||
->and($object->setParameters(['certificate' => 'test.pem', 'passPhrase' => 'test']))
|
||||
->and($object->setResponse(new Response()))
|
||||
->array($object->getParameters())
|
||||
->isNotEmpty()
|
||||
->hasSize(2)
|
||||
->isNotEmpty()
|
||||
->hasSize(2)
|
||||
->string($object->getParameter('certificate'))
|
||||
->isEqualTo('test.pem')
|
||||
;
|
||||
->isEqualTo('test.pem');
|
||||
}
|
||||
|
||||
public function testSupports()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Apns())
|
||||
->boolean($object->supports('wrongToken'))
|
||||
->isFalse()
|
||||
->boolean($object->supports(self::APNS_TOKEN_EXAMPLE))
|
||||
->isTrue()
|
||||
;
|
||||
->isFalse()
|
||||
->boolean($object->supports(self::APNS_TOKEN_EXAMPLE_64))
|
||||
->isTrue()
|
||||
->boolean($object->supports(self::APNS_TOKEN_EXAMPLE_65))
|
||||
->isTrue();
|
||||
}
|
||||
|
||||
public function testDefinedParameters()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Apns())
|
||||
->array($defaultParameters = $object->getDefinedParameters())
|
||||
->isEmpty()
|
||||
;
|
||||
->isEmpty();
|
||||
}
|
||||
|
||||
public function testDefaultParameters()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Apns())
|
||||
->array($defaultParameters = $object->getDefaultParameters())
|
||||
->isNotEmpty()
|
||||
->hasKey('passPhrase')
|
||||
->isNotEmpty()
|
||||
->hasKey('passPhrase')
|
||||
->variable($defaultParameters['passPhrase'])
|
||||
->isNull()
|
||||
;
|
||||
->isNull();
|
||||
}
|
||||
|
||||
public function testRequiredParameters()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Apns())
|
||||
->array($requiredParameters = $object->getRequiredParameters())
|
||||
->isNotEmpty()
|
||||
->contains('certificate')
|
||||
;
|
||||
->isNotEmpty()
|
||||
->contains('certificate');
|
||||
}
|
||||
|
||||
public function testGetOpenedClient()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Apns())
|
||||
->and($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockGenerator()->orphanize('open'))
|
||||
->and($this->mockClass('\ZendService\Apple\Apns\Client\Message', '\Mock\ZendService'))
|
||||
->and($this->mockClass(ZendClientMessage::class, '\Mock\ZendService'))
|
||||
->and($serviceClient = new \Mock\ZendService\Message())
|
||||
->and($object->getMockController()->getParameters = [])
|
||||
->exception(function() use($object) {
|
||||
$object->getOpenedClient(new BaseServiceClient());
|
||||
->exception(static function () use ($object) {
|
||||
$object->getOpenedClient(new ZendClientMessage());
|
||||
})
|
||||
->isInstanceOf('\ZendService\Apple\Exception\InvalidArgumentException')
|
||||
->message
|
||||
->contains('Certificate must be a valid path to a APNS certificate')
|
||||
|
||||
->when($object = new TestedModel(['certificate' => __DIR__.'/../Resources/apns-certificate.pem']))
|
||||
->and($object->getOpenedClient($serviceClient))
|
||||
;
|
||||
->isInstanceOf(InvalidArgumentException::class)
|
||||
->message
|
||||
->contains('Certificate must be a valid path to a APNS certificate')
|
||||
->when($object = new TestedModel(['certificate' => __DIR__ . '/../Resources/apns-certificate.pem']))
|
||||
->and($object->getOpenedClient($serviceClient));
|
||||
}
|
||||
|
||||
public function testGetServiceMessageFromOrigin()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Apns())
|
||||
|
||||
->and($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Model\Device', '\Mock'))
|
||||
->and($this->mockClass(Device::class, '\Mock'))
|
||||
->and($device = new \Mock\Device())
|
||||
->and($device->getMockController()->getToken = self::APNS_TOKEN_EXAMPLE)
|
||||
|
||||
->and($device->getMockController()->getToken = self::APNS_TOKEN_EXAMPLE_64)
|
||||
->and($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Model\Message', '\Mock'))
|
||||
->and($this->mockClass(Message::class, '\Mock'))
|
||||
->and($message = new \Mock\Message())
|
||||
->and($message->getMockController()->getText = 'Test')
|
||||
|
||||
->object($object->getServiceMessageFromOrigin($device, $message))
|
||||
->isInstanceOf('\ZendService\Apple\Apns\Message')
|
||||
;
|
||||
->isInstanceOf(ZendServiceMessage::class);
|
||||
}
|
||||
|
||||
public function testPush()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct')
|
||||
->makeVisible('getOpenedServiceClient')
|
||||
->generate(\Sly\NotificationPusher\Adapter\Apns::class, '\Mock', 'Apns'))
|
||||
->makeVisible('getOpenedServiceClient')
|
||||
->generate(TestedModel::class, '\Mock', 'Apns'))
|
||||
->and($object = new \Mock\Apns())
|
||||
->and($object->setResponse(new Response()))
|
||||
|
||||
->and($this->mockClass(\ZendService\Apple\Apns\Response\Message::class, '\Mock\ZendService', 'Response'))
|
||||
->and($this->mockClass(ZendResponseMessage::class, '\Mock\ZendService', 'Response'))
|
||||
->and($serviceResponse = new \Mock\ZendService\Response())
|
||||
->and($serviceResponse->getMockController()->getCode = \ZendService\Apple\Apns\Response\Message::RESULT_OK)
|
||||
->and($serviceResponse->getMockController()->getCode = ZendResponseMessage::RESULT_OK)
|
||||
->and($serviceResponse->getMockController()->getId = 0)
|
||||
|
||||
->and($this->mockGenerator()->orphanize('__construct')
|
||||
->orphanize('open')
|
||||
->orphanize('send')
|
||||
->generate(\ZendService\Apple\Apns\Client\Message::class, '\Mock\ZendService'))
|
||||
->orphanize('open')
|
||||
->orphanize('send')
|
||||
->generate(ZendClientMessage::class, '\Mock\ZendService'))
|
||||
->and($serviceClient = new \Mock\ZendService\Message())
|
||||
->and($serviceClient->getMockController()->send = $serviceResponse)
|
||||
|
||||
->and($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass(\Sly\NotificationPusher\Model\Push::class, '\Mock'))
|
||||
->and($this->mockClass(Push::class, '\Mock'))
|
||||
->and($push = new \Mock\Push())
|
||||
->and($push->getMockController()->getMessage = new BaseMessage('Test'))
|
||||
->and($push->getMockController()->getDevices = new BaseDeviceCollection(
|
||||
[new BaseDevice(self::APNS_TOKEN_EXAMPLE)]
|
||||
->and($push->getMockController()->getMessage = new Message('Test'))
|
||||
->and($push->getMockController()->getDevices = new DeviceCollection(
|
||||
[new Device(self::APNS_TOKEN_EXAMPLE_64)]
|
||||
))
|
||||
|
||||
->and($object->getMockController()->getServiceMessageFromOrigin = new BaseServiceMessage())
|
||||
->and($object->getMockController()->getServiceMessageFromOrigin = new ZendServiceMessage())
|
||||
->and($object->getMockController()->getOpenedClient = $serviceClient)
|
||||
->and($this->calling($object)->getOpenedServiceClient = $serviceClient)
|
||||
|
||||
->object($result = $object->push($push))
|
||||
->isInstanceOf('\Sly\NotificationPusher\Collection\DeviceCollection')
|
||||
->boolean($result->count() == 1)
|
||||
->isTrue();
|
||||
->isInstanceOf(DeviceCollection::class)
|
||||
->boolean($result->count() == 1)
|
||||
->isTrue();
|
||||
}
|
||||
|
||||
public function testCountIsEmpty() {
|
||||
public function testCountIsEmpty()
|
||||
{
|
||||
$this->if($dcoll = new DeviceCollection())
|
||||
->boolean($dcoll->isEmpty())
|
||||
->isTrue();
|
||||
->isTrue();
|
||||
}
|
||||
|
||||
public function testFeedback()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Apns())
|
||||
|
||||
->and($this->mockClass('\ZendService\Apple\Apns\Response\Message', '\Mock\ZendService', 'Response'))
|
||||
->and($this->mockClass(ZendResponseMessage::class, '\Mock\ZendService', 'Response'))
|
||||
->and($serviceResponse = new \Mock\ZendService\Response())
|
||||
|
||||
->and($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockGenerator()->orphanize('open'))
|
||||
->and($this->mockGenerator()->orphanize('send'))
|
||||
->and($this->mockClass('\ZendService\Apple\Apns\Client\Feedback', '\Mock\ZendService'))
|
||||
->and($this->mockClass(Feedback::class, '\Mock\ZendService'))
|
||||
->and($serviceClient = new \Mock\ZendService\Feedback())
|
||||
->and($serviceClient->getMockController()->feedback = $serviceResponse)
|
||||
|
||||
->and($object->getMockController()->getServiceMessageFromOrigin = new BaseServiceMessage())
|
||||
->and($object->getMockController()->getServiceMessageFromOrigin = new ZendServiceMessage())
|
||||
->and($object->getMockController()->getOpenedClient = $serviceClient)
|
||||
|
||||
->array($object->getFeedback())
|
||||
->isEmpty()
|
||||
;
|
||||
->isEmpty();
|
||||
}
|
||||
}
|
||||
|
@@ -3,11 +3,9 @@
|
||||
namespace tests\units\Sly\NotificationPusher\Adapter;
|
||||
|
||||
use mageekguy\atoum as Units;
|
||||
use Sly\NotificationPusher\PushManager as BasePushManager;
|
||||
use Sly\NotificationPusher\PushManager;
|
||||
|
||||
/**
|
||||
* BaseAdapter.
|
||||
*
|
||||
* @uses atoum\test
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
@@ -16,37 +14,33 @@ class BaseAdapter extends Units\Test
|
||||
public function testAdapterKey()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
|
||||
->and($this->mockClass(\Sly\NotificationPusher\Adapter\Apns::class, '\Mock'))
|
||||
->and($object = new \Mock\Apns())
|
||||
->and($object->getMockController()->getAdapterKey = 'Apns')
|
||||
->string($object->getAdapterKey())
|
||||
->isEqualTo('Apns')
|
||||
->isEqualTo('Apns')
|
||||
->string((string) $object)
|
||||
->isEqualTo('Apns')
|
||||
;
|
||||
->isEqualTo('Apns');
|
||||
}
|
||||
|
||||
public function testEnvironment()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
|
||||
->and($this->mockClass(\Sly\NotificationPusher\Adapter\Apns::class, '\Mock'))
|
||||
->and($object = new \Mock\Apns())
|
||||
|
||||
->when($object->setEnvironment(BasePushManager::ENVIRONMENT_DEV))
|
||||
->when($object->setEnvironment(PushManager::ENVIRONMENT_DEV))
|
||||
->string($object->getEnvironment())
|
||||
->isEqualTo(BasePushManager::ENVIRONMENT_DEV)
|
||||
->isEqualTo(PushManager::ENVIRONMENT_DEV)
|
||||
->boolean($object->isDevelopmentEnvironment())
|
||||
->isTrue()
|
||||
->isTrue()
|
||||
->boolean($object->isProductionEnvironment())
|
||||
->isFalse()
|
||||
|
||||
->when($object->setEnvironment(BasePushManager::ENVIRONMENT_PROD))
|
||||
->isFalse()
|
||||
->when($object->setEnvironment(PushManager::ENVIRONMENT_PROD))
|
||||
->string($object->getEnvironment())
|
||||
->isEqualTo(BasePushManager::ENVIRONMENT_PROD)
|
||||
->isEqualTo(PushManager::ENVIRONMENT_PROD)
|
||||
->boolean($object->isProductionEnvironment())
|
||||
->isTrue()
|
||||
->isTrue()
|
||||
->boolean($object->isDevelopmentEnvironment())
|
||||
->isFalse()
|
||||
;
|
||||
->isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -4,18 +4,19 @@ namespace tests\units\Sly\NotificationPusher\Adapter;
|
||||
|
||||
use mageekguy\atoum as Units;
|
||||
use Sly\NotificationPusher\Adapter\Gcm as TestedModel;
|
||||
|
||||
use Sly\NotificationPusher\Model\Message as BaseMessage;
|
||||
use Sly\NotificationPusher\Model\Device as BaseDevice;
|
||||
use Sly\NotificationPusher\Collection\DeviceCollection as BaseDeviceCollection;
|
||||
|
||||
use Sly\NotificationPusher\Collection\DeviceCollection;
|
||||
use Sly\NotificationPusher\Model\Device;
|
||||
use Sly\NotificationPusher\Model\GcmMessage;
|
||||
use Sly\NotificationPusher\Model\Message;
|
||||
use Sly\NotificationPusher\Model\Push;
|
||||
use Sly\NotificationPusher\Model\Response;
|
||||
use ZendService\Google\Gcm\Client as BaseServiceClient;
|
||||
use ZendService\Google\Gcm\Message as BaseServiceMessage;
|
||||
use Symfony\Component\OptionsResolver\Exception\MissingOptionsException;
|
||||
use ZendService\Google\Exception\InvalidArgumentException;
|
||||
use ZendService\Google\Gcm\Client as ZendServiceClient;
|
||||
use ZendService\Google\Gcm\Message as ZendServiceMessage;
|
||||
use ZendService\Google\Gcm\Response as ZendResponseAlias;
|
||||
|
||||
/**
|
||||
* Gcm.
|
||||
*
|
||||
* @uses atoum\test
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
@@ -28,49 +29,46 @@ class Gcm extends Units\Test
|
||||
public function testConstruct()
|
||||
{
|
||||
$this
|
||||
->exception(function() {
|
||||
->exception(function () {
|
||||
$object = new TestedModel();
|
||||
})
|
||||
->isInstanceOf('\Symfony\Component\OptionsResolver\Exception\MissingOptionsException')
|
||||
->message
|
||||
->contains('apiKey')
|
||||
|
||||
->isInstanceOf(MissingOptionsException::class)
|
||||
->message
|
||||
->contains('apiKey')
|
||||
->when($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Gcm', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Gcm())
|
||||
->and($object->setParameters(['apiKey' => 'test']))
|
||||
->array($object->getParameters())
|
||||
->isNotEmpty()
|
||||
->hasSize(1)
|
||||
->isNotEmpty()
|
||||
->hasSize(1)
|
||||
->string($object->getParameter('apiKey'))
|
||||
->isEqualTo('test')
|
||||
;
|
||||
->isEqualTo('test');
|
||||
}
|
||||
|
||||
public function testSupports()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Gcm', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Gcm())
|
||||
->boolean($object->supports('')) // Test empty string
|
||||
->isFalse()
|
||||
->isFalse()
|
||||
->boolean($object->supports(2)) // Test a number
|
||||
->isFalse()
|
||||
->isFalse()
|
||||
->boolean($object->supports([])) // Test an array
|
||||
->isFalse()
|
||||
->isFalse()
|
||||
->boolean($object->supports(json_decode('{}'))) // Tests an object
|
||||
->isFalse()
|
||||
->isFalse()
|
||||
->boolean($object->supports(self::GCM_TOKEN_EXAMPLE))
|
||||
->isTrue()
|
||||
->isTrue()
|
||||
->boolean($object->supports(self::ALT_GCM_TOKEN_EXAMPLE))
|
||||
->isTrue()
|
||||
;
|
||||
->isTrue();
|
||||
}
|
||||
|
||||
public function testDefinedParameters()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Gcm', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Gcm())
|
||||
->array($definedParameters = $object->getDefinedParameters())
|
||||
->isNotEmpty()
|
||||
@@ -79,129 +77,115 @@ class Gcm extends Units\Test
|
||||
'delayWhileIdle',
|
||||
'ttl',
|
||||
'restrictedPackageName',
|
||||
'dryRun'
|
||||
'dryRun',
|
||||
]);
|
||||
}
|
||||
|
||||
public function testDefaultParameters()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Gcm', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Gcm())
|
||||
->array($defaultParameters = $object->getDefaultParameters())
|
||||
->isEmpty()
|
||||
;
|
||||
->isEmpty();
|
||||
}
|
||||
|
||||
public function testRequiredParameters()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Gcm', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Gcm())
|
||||
->array($requiredParameters = $object->getRequiredParameters())
|
||||
->isNotEmpty()
|
||||
->contains('apiKey')
|
||||
;
|
||||
->isNotEmpty()
|
||||
->contains('apiKey');
|
||||
}
|
||||
|
||||
public function testGetOpenedClient()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Gcm', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Gcm())
|
||||
->and($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockGenerator()->orphanize('open'))
|
||||
->and($this->mockClass('\ZendService\Google\Gcm\Client', '\Mock\ZendService'))
|
||||
->and($this->mockClass(ZendServiceClient::class, '\Mock\ZendService'))
|
||||
->and($serviceClient = new \Mock\ZendService\Client())
|
||||
->and($object->getMockController()->getParameters = [])
|
||||
->exception(function() use($object) {
|
||||
$object->getOpenedClient(new BaseServiceClient());
|
||||
->exception(function () use ($object) {
|
||||
$object->getOpenedClient(new ZendServiceClient());
|
||||
})
|
||||
->isInstanceOf('\ZendService\Google\Exception\InvalidArgumentException')
|
||||
->message
|
||||
->contains('The api key must be a string and not empty')
|
||||
|
||||
->isInstanceOf(InvalidArgumentException::class)
|
||||
->message
|
||||
->contains('The api key must be a string and not empty')
|
||||
->when($object = new TestedModel(['apiKey' => 'test']))
|
||||
->and($object->getOpenedClient($serviceClient))
|
||||
;
|
||||
->and($object->getOpenedClient($serviceClient));
|
||||
}
|
||||
|
||||
public function testGetServiceMessageFromOrigin()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass(\Sly\NotificationPusher\Adapter\Gcm::class, '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Gcm())
|
||||
|
||||
->and($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass(\Sly\NotificationPusher\Model\Message::class, '\Mock'))
|
||||
->and($this->mockClass(Message::class, '\Mock'))
|
||||
->and($message = new \Mock\Message())
|
||||
->and($message->getMockController()->getOptions = [
|
||||
'param' => 'test',
|
||||
'notificationData' => ['some' => 'foobar']
|
||||
])
|
||||
'param' => 'test',
|
||||
'notificationData' => ['some' => 'foobar'],
|
||||
])
|
||||
->and($message->getMockController()->getText = 'Test')
|
||||
|
||||
->object($originalMessage = $object->getServiceMessageFromOrigin([self::GCM_TOKEN_EXAMPLE], $message))
|
||||
->isInstanceOf(\ZendService\Google\Gcm\Message::class)
|
||||
->array($originalMessage->getData())
|
||||
->notHasKey('notificationData')
|
||||
->array($originalMessage->getNotification())
|
||||
->hasKey('some')
|
||||
->contains('foobar');
|
||||
->isInstanceOf(ZendServiceMessage::class)
|
||||
->array($originalMessage->getData())
|
||||
->notHasKey('notificationData')
|
||||
->array($originalMessage->getNotification())
|
||||
->hasKey('some')
|
||||
->contains('foobar');
|
||||
}
|
||||
|
||||
public function testGcmMessageUse()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass(\Sly\NotificationPusher\Adapter\Gcm::class, '\Mock'))
|
||||
->and($object = new \Mock\Gcm())
|
||||
|
||||
->and($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass(\Sly\NotificationPusher\Model\GcmMessage::class, '\Mock'))
|
||||
->and($message = new \Mock\GcmMessage())
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Gcm())
|
||||
->and($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass(GcmMessage::class, '\Mock'))
|
||||
->and($message = new \Mock\GcmMessage())
|
||||
->and($message->getMockController()->getNotificationData = [
|
||||
'some' => 'foobar'
|
||||
'some' => 'foobar',
|
||||
])
|
||||
->and($message->getMockController()->getText = 'Test')
|
||||
|
||||
->object($originalMessage = $object->getServiceMessageFromOrigin([self::GCM_TOKEN_EXAMPLE], $message))
|
||||
->isInstanceOf(\ZendService\Google\Gcm\Message::class)
|
||||
->array($originalMessage->getData())
|
||||
->notHasKey('notificationData')
|
||||
->array($originalMessage->getNotification())
|
||||
->hasKey('some')
|
||||
->contains('foobar');
|
||||
->isInstanceOf(ZendServiceMessage::class)
|
||||
->array($originalMessage->getData())
|
||||
->notHasKey('notificationData')
|
||||
->array($originalMessage->getNotification())
|
||||
->hasKey('some')
|
||||
->contains('foobar');
|
||||
}
|
||||
|
||||
public function testPush()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Gcm', '\Mock'))
|
||||
->and($this->mockClass(TestedModel::class, '\Mock'))
|
||||
->and($object = new \Mock\Gcm())
|
||||
->and($object->setResponse(new Response()))
|
||||
|
||||
->and($this->mockClass('\ZendService\Google\Gcm\Response', '\Mock\ZendService'))
|
||||
->and($this->mockClass(ZendResponseAlias::class, '\Mock\ZendService'))
|
||||
->and($serviceResponse = new \Mock\ZendService\Response())
|
||||
|
||||
->and($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockGenerator()->orphanize('open'))
|
||||
->and($this->mockGenerator()->orphanize('send'))
|
||||
->and($this->mockClass('\ZendService\Google\Gcm\Client', '\Mock\ZendService'))
|
||||
->and($this->mockClass(ZendServiceClient::class, '\Mock\ZendService'))
|
||||
->and($serviceClient = new \Mock\ZendService\Message())
|
||||
->and($serviceClient->getMockController()->send = new $serviceResponse)
|
||||
|
||||
->and($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Model\Push', '\Mock'))
|
||||
->and($this->mockClass(Push::class, '\Mock'))
|
||||
->and($push = new \Mock\Push())
|
||||
->and($push->getMockController()->getMessage = new BaseMessage('Test'))
|
||||
->and($push->getMockController()->getDevices = new BaseDeviceCollection([new BaseDevice(self::GCM_TOKEN_EXAMPLE)]))
|
||||
|
||||
->and($object->getMockController()->getServiceMessageFromOrigin = new BaseServiceMessage())
|
||||
->and($push->getMockController()->getMessage = new Message('Test'))
|
||||
->and($push->getMockController()->getDevices = new DeviceCollection([new Device(self::GCM_TOKEN_EXAMPLE)]))
|
||||
->and($object->getMockController()->getServiceMessageFromOrigin = new ZendServiceMessage())
|
||||
->and($object->getMockController()->getOpenedClient = $serviceClient)
|
||||
|
||||
->object($object->push($push))
|
||||
->isInstanceOf('\Sly\NotificationPusher\Collection\DeviceCollection')
|
||||
->hasSize(1)
|
||||
;
|
||||
->isInstanceOf(DeviceCollection::class)
|
||||
->hasSize(1);
|
||||
}
|
||||
}
|
||||
|
@@ -6,8 +6,6 @@ use mageekguy\atoum as Units;
|
||||
use Sly\NotificationPusher\Model\Message;
|
||||
|
||||
/**
|
||||
* BaseOptionedModel.
|
||||
*
|
||||
* @uses atoum\test
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
@@ -17,34 +15,29 @@ class BaseOptionedModel extends Units\Test
|
||||
{
|
||||
$this->if($object = new Message('Test', ['param' => 'test']))
|
||||
->boolean($object->hasOption('param'))
|
||||
->isTrue()
|
||||
->isTrue()
|
||||
->string($object->getOption('param'))
|
||||
->isEqualTo('test')
|
||||
|
||||
->isEqualTo('test')
|
||||
->boolean($object->hasOption('notExist'))
|
||||
->isFalse()
|
||||
->isFalse()
|
||||
->variable($object->getOption('notExist'))
|
||||
->isNull()
|
||||
->isNull()
|
||||
->string($object->getOption('renotExist', '12345'))
|
||||
->isEqualTo('12345')
|
||||
|
||||
->isEqualTo('12345')
|
||||
->when($object->setOptions(['chuck' => 'norris']))
|
||||
->boolean($object->hasOption('chuck'))
|
||||
->isTrue()
|
||||
->isTrue()
|
||||
->string($object->getOption('chuck'))
|
||||
->isEqualTo('norris')
|
||||
|
||||
->isEqualTo('norris')
|
||||
->when($object->setOption('poney', 'powerful'))
|
||||
->boolean($object->hasOption('poney'))
|
||||
->isTrue()
|
||||
->isTrue()
|
||||
->string($object->getOption('poney'))
|
||||
->isEqualTo('powerful')
|
||||
|
||||
->isEqualTo('powerful')
|
||||
->when($object->setOption('null', null))
|
||||
->boolean($object->hasOption('null'))
|
||||
->isTrue()
|
||||
->isTrue()
|
||||
->variable($object->getOption('null'))
|
||||
->isNull()
|
||||
;
|
||||
->isNull();
|
||||
}
|
||||
}
|
||||
|
@@ -6,8 +6,6 @@ use mageekguy\atoum as Units;
|
||||
use Sly\NotificationPusher\Model\Device;
|
||||
|
||||
/**
|
||||
* BaseParameteredModel.
|
||||
*
|
||||
* @uses atoum\test
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
@@ -17,34 +15,29 @@ class BaseParameteredModel extends Units\Test
|
||||
{
|
||||
$this->if($object = new Device('Test', ['param' => 'test']))
|
||||
->boolean($object->hasParameter('param'))
|
||||
->isTrue()
|
||||
->isTrue()
|
||||
->string($object->getParameter('param'))
|
||||
->isEqualTo('test')
|
||||
|
||||
->isEqualTo('test')
|
||||
->boolean($object->hasParameter('notExist'))
|
||||
->isFalse()
|
||||
->isFalse()
|
||||
->variable($object->getParameter('notExist'))
|
||||
->isNull()
|
||||
->isNull()
|
||||
->string($object->getParameter('renotExist', '12345'))
|
||||
->isEqualTo('12345')
|
||||
|
||||
->isEqualTo('12345')
|
||||
->when($object->setParameters(['chuck' => 'norris']))
|
||||
->boolean($object->hasParameter('chuck'))
|
||||
->isTrue()
|
||||
->isTrue()
|
||||
->string($object->getParameter('chuck'))
|
||||
->isEqualTo('norris')
|
||||
|
||||
->isEqualTo('norris')
|
||||
->when($object->setParameter('poney', 'powerful'))
|
||||
->boolean($object->hasParameter('poney'))
|
||||
->isTrue()
|
||||
->isTrue()
|
||||
->string($object->getParameter('poney'))
|
||||
->isEqualTo('powerful')
|
||||
|
||||
->isEqualTo('powerful')
|
||||
->when($object->setParameter('null', null))
|
||||
->boolean($object->hasParameter('null'))
|
||||
->isTrue()
|
||||
->isTrue()
|
||||
->variable($object->getParameter('null'))
|
||||
->isNull()
|
||||
;
|
||||
->isNull();
|
||||
}
|
||||
}
|
||||
|
@@ -6,8 +6,6 @@ use mageekguy\atoum as Units;
|
||||
use Sly\NotificationPusher\Model\Device as TestedModel;
|
||||
|
||||
/**
|
||||
* Device.
|
||||
*
|
||||
* @uses atoum\test
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
@@ -17,18 +15,16 @@ class Device extends Units\Test
|
||||
{
|
||||
$this->if($object = new TestedModel('t0k3n'))
|
||||
->string($object->getToken())->isEqualTo('t0k3n')
|
||||
->array($object->getParameters())->isEmpty()
|
||||
;
|
||||
->array($object->getParameters())->isEmpty();
|
||||
|
||||
$this->if($object = new TestedModel('t0k3n', ['param' => 'test']))
|
||||
->string($object->getToken())->isEqualTo('t0k3n')
|
||||
->when($object->setToken('t0k3ns3tt3d'))
|
||||
->string($object->getToken())->isEqualTo('t0k3ns3tt3d')
|
||||
->array($object->getParameters())
|
||||
->hasKey('param')
|
||||
->contains('test')
|
||||
->size
|
||||
->isEqualTo(1)
|
||||
;
|
||||
->hasKey('param')
|
||||
->contains('test')
|
||||
->size
|
||||
->isEqualTo(1);
|
||||
}
|
||||
}
|
||||
|
@@ -6,8 +6,6 @@ use mageekguy\atoum as Units;
|
||||
use Sly\NotificationPusher\Model\Message as TestedModel;
|
||||
|
||||
/**
|
||||
* Message.
|
||||
*
|
||||
* @uses atoum\test
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
@@ -17,20 +15,18 @@ class Message extends Units\Test
|
||||
{
|
||||
$this->if($object = new TestedModel('Test'))
|
||||
->string($object->getText())->isEqualTo('Test')
|
||||
->array($object->getOptions())->isEmpty()
|
||||
;
|
||||
->array($object->getOptions())->isEmpty();
|
||||
|
||||
$this->if($object = new TestedModel('Test', [
|
||||
'param' => 'test',
|
||||
]))
|
||||
'param' => 'test',
|
||||
]))
|
||||
->string($object->getText())->isEqualTo('Test')
|
||||
->when($object->setText('Test 2'))
|
||||
->string($object->getText())->isEqualTo('Test 2')
|
||||
->array($object->getOptions())
|
||||
->hasKey('param')
|
||||
->contains('test')
|
||||
->size
|
||||
->isEqualTo(1)
|
||||
;
|
||||
->hasKey('param')
|
||||
->contains('test')
|
||||
->size
|
||||
->isEqualTo(1);
|
||||
}
|
||||
}
|
||||
|
@@ -3,165 +3,144 @@
|
||||
namespace tests\units\Sly\NotificationPusher\Model;
|
||||
|
||||
use mageekguy\atoum as Units;
|
||||
use Sly\NotificationPusher\Adapter\AdapterInterface;
|
||||
use Sly\NotificationPusher\Adapter\Apns;
|
||||
use Sly\NotificationPusher\Adapter\Gcm;
|
||||
use Sly\NotificationPusher\Collection\DeviceCollection;
|
||||
use Sly\NotificationPusher\Exception\AdapterException;
|
||||
use Sly\NotificationPusher\Model\Device as DeviceModel;
|
||||
use Sly\NotificationPusher\Model\Message as MessageModel;
|
||||
use Sly\NotificationPusher\Model\Push as TestedModel;
|
||||
|
||||
use Sly\NotificationPusher\Model\Message as BaseMessage;
|
||||
use Sly\NotificationPusher\Model\Device as BaseDevice;
|
||||
use Sly\NotificationPusher\Collection\DeviceCollection as BaseDeviceCollection;
|
||||
use Sly\NotificationPusher\Adapter\Apns as BaseApnsAdapter;
|
||||
|
||||
/**
|
||||
* Push.
|
||||
*
|
||||
* @uses atoum\test
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
class Push extends Units\Test
|
||||
{
|
||||
const APNS_TOKEN_EXAMPLE = '111db24975bb6c6b63214a8d268052aa0a965cc1e32110ab06a72b19074c2222';
|
||||
const GCM_TOKEN_EXAMPLE = 'AAA91bG9ISdL94D55C69NplFlxicy0iFUFTyWh3AAdMfP9npH5r_JQFTo27xpX1jfqGf-aSe6xZAsfWRefjazJpqFt03Isanv-Fi97020EKLye0ApTkHsw_0tJJzgA2Js0NsG1jLWsiJf63YSF8ropAcRp4BSxVBBB';
|
||||
const GCM_TOKEN_EXAMPLE = 'AAA91bG9ISdL94D55C69NplFlxicy0iFUFTyWh3AAdMfP9npH5r_JQFTo27xpX1jfqGf-aSe6xZAsfWRefjazJpqFt03Isanv-Fi97020EKLye0ApTkHsw_0tJJzgA2Js0NsG1jLWsiJf63YSF8ropAcRp4BSxVBBB';
|
||||
|
||||
public function testConstructWithOneDevice()
|
||||
{
|
||||
$this->if($this->mockClass('\Sly\NotificationPusher\Adapter\AdapterInterface', '\Mock'))
|
||||
$this->if($this->mockClass(AdapterInterface::class, '\Mock'))
|
||||
->and($adapter = new \Mock\AdapterInterface())
|
||||
->and($devices = new BaseDevice('Token1'))
|
||||
->and($message = new BaseMessage('Test'))
|
||||
|
||||
->and($devices = new DeviceModel('Token1'))
|
||||
->and($message = new MessageModel('Test'))
|
||||
->and($object = new TestedModel($adapter, $devices, $message))
|
||||
|
||||
->object($object->getDevices())
|
||||
->isInstanceOf('\Sly\NotificationPusher\Collection\DeviceCollection')
|
||||
->isInstanceOf(DeviceCollection::class)
|
||||
->integer($object->getDevices()->count())
|
||||
->isEqualTo(1)
|
||||
->isEqualTo(1)
|
||||
->array($object->getOptions())
|
||||
->isEmpty()
|
||||
;
|
||||
->isEmpty();
|
||||
}
|
||||
|
||||
public function testConstructWithManyDevicesAndOptions()
|
||||
{
|
||||
$this->if($this->mockClass('\Sly\NotificationPusher\Adapter\AdapterInterface', '\Mock'))
|
||||
$this->if($this->mockClass(AdapterInterface::class, '\Mock'))
|
||||
->and($adapter = new \Mock\AdapterInterface())
|
||||
->and($devices = new BaseDeviceCollection([new BaseDevice('Token1'), new BaseDevice('Token2'), new BaseDevice('Token3')]))
|
||||
->and($message = new BaseMessage('Test'))
|
||||
|
||||
->and($devices = new DeviceCollection([new DeviceModel('Token1'), new DeviceModel('Token2'),
|
||||
new DeviceModel('Token3')]))
|
||||
->and($message = new MessageModel('Test'))
|
||||
->and($object = new TestedModel($adapter, $devices, $message, ['param' => 'test']))
|
||||
|
||||
->object($object->getDevices())
|
||||
->isInstanceOf('\Sly\NotificationPusher\Collection\DeviceCollection')
|
||||
->isInstanceOf(DeviceCollection::class)
|
||||
->integer($object->getDevices()->count())
|
||||
->isEqualTo(3)
|
||||
->isEqualTo(3)
|
||||
->array($object->getOptions())
|
||||
->hasKey('param')
|
||||
->contains('test')
|
||||
->size
|
||||
->isEqualTo(1)
|
||||
;
|
||||
->hasKey('param')
|
||||
->contains('test')
|
||||
->size
|
||||
->isEqualTo(1);
|
||||
}
|
||||
|
||||
public function testStatus()
|
||||
{
|
||||
date_default_timezone_set('UTC');
|
||||
$this->if($this->mockClass('\Sly\NotificationPusher\Adapter\AdapterInterface', '\Mock'))
|
||||
$this->if($this->mockClass(AdapterInterface::class, '\Mock'))
|
||||
->and($adapter = new \Mock\AdapterInterface())
|
||||
->and($devices = new BaseDeviceCollection([new BaseDevice('Token1'), new BaseDevice('Token2'), new BaseDevice('Token3')]))
|
||||
->and($message = new BaseMessage('Test'))
|
||||
|
||||
->and($devices = new DeviceCollection([new DeviceModel('Token1'), new DeviceModel('Token2'),
|
||||
new DeviceModel('Token3')]))
|
||||
->and($message = new MessageModel('Test'))
|
||||
->and($object = new TestedModel($adapter, $devices, $message))
|
||||
|
||||
->string($object->getStatus())
|
||||
->isEqualTo(TestedModel::STATUS_PENDING)
|
||||
->isEqualTo(TestedModel::STATUS_PENDING)
|
||||
->boolean($object->isPushed())
|
||||
->isFalse()
|
||||
|
||||
->isFalse()
|
||||
->when($object->pushed())
|
||||
->and($dt = new \DateTime())
|
||||
->string($object->getStatus())
|
||||
->isEqualTo(TestedModel::STATUS_PUSHED)
|
||||
->isEqualTo(TestedModel::STATUS_PUSHED)
|
||||
->boolean($object->isPushed())
|
||||
->isTrue()
|
||||
->isTrue()
|
||||
->dateTime($object->getPushedAt())
|
||||
->hasDate($dt->format("Y"), $dt->format("m"), $dt->format('d'))
|
||||
|
||||
->hasDate($dt->format("Y"), $dt->format("m"), $dt->format('d'))
|
||||
->when($object->setStatus(TestedModel::STATUS_PENDING))
|
||||
->string($object->getStatus())
|
||||
->isEqualTo(TestedModel::STATUS_PENDING)
|
||||
->isEqualTo(TestedModel::STATUS_PENDING)
|
||||
->boolean($object->isPushed())
|
||||
->isFalse()
|
||||
|
||||
->isFalse()
|
||||
->when($fDt = new \DateTime('2013-01-01'))
|
||||
->and($object->setPushedAt($fDt))
|
||||
->dateTime($object->getPushedAt())
|
||||
->isIdenticalTo($fDt)
|
||||
;
|
||||
->isIdenticalTo($fDt);
|
||||
}
|
||||
|
||||
public function testDevicesTokensCheck()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
|
||||
->and($this->mockClass(Apns::class, '\Mock'))
|
||||
->and($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Gcm', '\Mock'))
|
||||
|
||||
->and($this->mockClass(Gcm::class, '\Mock'))
|
||||
->and($apnsAdapter = new \mock\Apns())
|
||||
->and($gcmAdapter = new \mock\Gcm())
|
||||
->and($badDevice = new BaseDevice('BadToken'))
|
||||
->and($message = new BaseMessage('Test'))
|
||||
|
||||
->and($badDevice = new DeviceModel('BadToken'))
|
||||
->and($message = new MessageModel('Test'))
|
||||
->exception(function () use ($apnsAdapter, $badDevice, $message) {
|
||||
$object = new TestedModel($apnsAdapter, $badDevice, $message);
|
||||
})
|
||||
->isInstanceOf('\Sly\NotificationPusher\Exception\AdapterException')
|
||||
|
||||
->when($goodDevice = new BaseDevice(self::APNS_TOKEN_EXAMPLE))
|
||||
->object($object = new TestedModel($apnsAdapter, $goodDevice, $message))
|
||||
;
|
||||
->isInstanceOf(AdapterException::class)
|
||||
->when($goodDevice = new DeviceModel(self::APNS_TOKEN_EXAMPLE))
|
||||
->object($object = new TestedModel($apnsAdapter, $goodDevice, $message));
|
||||
}
|
||||
|
||||
public function testAdapter()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
|
||||
->and($this->mockClass(Apns::class, '\Mock'))
|
||||
->and($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Gcm', '\Mock'))
|
||||
|
||||
->and($this->mockClass(Gcm::class, '\Mock'))
|
||||
->and($apnsAdapter = new \mock\Apns())
|
||||
->and($gcmAdapter = new \mock\Gcm())
|
||||
->and($devices = new BaseDevice(self::APNS_TOKEN_EXAMPLE))
|
||||
->and($message = new BaseMessage('Test'))
|
||||
|
||||
->and($devices = new DeviceModel(self::APNS_TOKEN_EXAMPLE))
|
||||
->and($message = new MessageModel('Test'))
|
||||
->and($object = new TestedModel($apnsAdapter, $devices, $message))
|
||||
|
||||
->object($object->getAdapter())
|
||||
->isInstanceOf('\Sly\NotificationPusher\Adapter\Apns')
|
||||
|
||||
->isInstanceOf(Apns::class)
|
||||
->when($object->setAdapter($gcmAdapter))
|
||||
->and($object->setDevices(new BaseDeviceCollection([new BaseDevice(self::GCM_TOKEN_EXAMPLE)])))
|
||||
->and($object->setDevices(new DeviceCollection([new DeviceModel(self::GCM_TOKEN_EXAMPLE)])))
|
||||
->object($object->getAdapter())
|
||||
->isInstanceOf('\Sly\NotificationPusher\Adapter\Gcm')
|
||||
;
|
||||
->isInstanceOf(Gcm::class);
|
||||
}
|
||||
|
||||
public function testMessage()
|
||||
{
|
||||
$this->if($this->mockClass('\Sly\NotificationPusher\Adapter\AdapterInterface', '\Mock'))
|
||||
$this->if($this->mockClass(AdapterInterface::class, '\Mock'))
|
||||
->and($adapter = new \Mock\AdapterInterface())
|
||||
->and($devices = new BaseDeviceCollection([new BaseDevice('Token1'), new BaseDevice('Token2'), new BaseDevice('Token3')]))
|
||||
->and($message = new BaseMessage('Test'))
|
||||
|
||||
->and($devices = new DeviceCollection([new DeviceModel('Token1'), new DeviceModel('Token2'),
|
||||
new DeviceModel('Token3')]))
|
||||
->and($message = new MessageModel('Test'))
|
||||
->and($object = new TestedModel($adapter, $devices, $message))
|
||||
->object($object->getMessage())
|
||||
->isInstanceOf('\Sly\NotificationPusher\Model\Message')
|
||||
->isInstanceOf(MessageModel::class)
|
||||
->string($object->getMessage()->getText())
|
||||
->isEqualTo('Test')
|
||||
|
||||
->when($object->setMessage(new BaseMessage('Test 2')))
|
||||
->isEqualTo('Test')
|
||||
->when($object->setMessage(new MessageModel('Test 2')))
|
||||
->object($object->getMessage())
|
||||
->isInstanceOf('\Sly\NotificationPusher\Model\Message')
|
||||
->isInstanceOf(MessageModel::class)
|
||||
->string($object->getMessage()->getText())
|
||||
->isEqualTo('Test 2')
|
||||
;
|
||||
->isEqualTo('Test 2');
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,16 +3,16 @@
|
||||
namespace tests\units\Sly\NotificationPusher;
|
||||
|
||||
use mageekguy\atoum as Units;
|
||||
use Sly\NotificationPusher\Adapter\Apns;
|
||||
use Sly\NotificationPusher\Collection\DeviceCollection;
|
||||
use Sly\NotificationPusher\Collection\PushCollection;
|
||||
use Sly\NotificationPusher\Model\Device;
|
||||
use Sly\NotificationPusher\Model\Message;
|
||||
use Sly\NotificationPusher\Model\Push;
|
||||
use Sly\NotificationPusher\Model\Response;
|
||||
use Sly\NotificationPusher\PushManager as TestedModel;
|
||||
|
||||
use Sly\NotificationPusher\Model\Message as BaseMessage;
|
||||
use Sly\NotificationPusher\Model\Device as BaseDevice;
|
||||
use Sly\NotificationPusher\Collection\DeviceCollection as BaseDeviceCollection;
|
||||
|
||||
/**
|
||||
* PushManager.
|
||||
*
|
||||
* @uses atoum\test
|
||||
* @author Cédric Dugat <cedric@dugat.me>
|
||||
*/
|
||||
@@ -24,69 +24,59 @@ class PushManager extends Units\Test
|
||||
{
|
||||
$this->if($object = new TestedModel())
|
||||
->string($object->getEnvironment())
|
||||
->isEqualTo(TestedModel::ENVIRONMENT_DEV)
|
||||
|
||||
->isEqualTo(TestedModel::ENVIRONMENT_DEV)
|
||||
->when($object = new TestedModel(TestedModel::ENVIRONMENT_PROD))
|
||||
->string($object->getEnvironment())
|
||||
->isEqualTo(TestedModel::ENVIRONMENT_PROD)
|
||||
;
|
||||
->isEqualTo(TestedModel::ENVIRONMENT_PROD);
|
||||
}
|
||||
|
||||
public function testCollection()
|
||||
{
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Model\Push', '\Mock'))
|
||||
->and($this->mockClass(Push::class, '\Mock'))
|
||||
->and($push = new \Mock\Push())
|
||||
->and($push->getMockController()->getMessage = new BaseMessage('Test'))
|
||||
->and($push->getMockController()->getDevices = new BaseDeviceCollection([new BaseDevice(self::APNS_TOKEN_EXAMPLE)]))
|
||||
->and($push->getMockController()->getMessage = new Message('Test'))
|
||||
->and($push->getMockController()->getDevices = new DeviceCollection([new Device(self::APNS_TOKEN_EXAMPLE)]))
|
||||
->and($push2 = new \Mock\Push())
|
||||
->and($push2->getMockController()->getMessage = new BaseMessage('Test 2'))
|
||||
->and($push2->getMockController()->getDevices = new BaseDeviceCollection([new BaseDevice(self::APNS_TOKEN_EXAMPLE)]))
|
||||
|
||||
->and($push2->getMockController()->getMessage = new Message('Test 2'))
|
||||
->and($push2->getMockController()->getDevices = new DeviceCollection([new Device(self::APNS_TOKEN_EXAMPLE)]))
|
||||
->and($object = (new TestedModel())->getPushCollection())
|
||||
|
||||
->when($object->add($push))
|
||||
->object($object)
|
||||
->isInstanceOf('\Sly\NotificationPusher\Collection\PushCollection')
|
||||
->isInstanceOf(PushCollection::class)
|
||||
->object($object->getIterator())
|
||||
->hasSize(1)
|
||||
->hasSize(1)
|
||||
->when($object->add($push2))
|
||||
->object($object)
|
||||
->isInstanceOf('\Sly\NotificationPusher\Collection\PushCollection')
|
||||
->isInstanceOf(PushCollection::class)
|
||||
->object($object->getIterator())
|
||||
->hasSize(2)
|
||||
|
||||
->hasSize(2)
|
||||
->object($object->first())
|
||||
->isEqualTo($push)
|
||||
->isEqualTo($push)
|
||||
->object($object->last())
|
||||
->isEqualTo($push2)
|
||||
;
|
||||
->isEqualTo($push2);
|
||||
}
|
||||
|
||||
public function testPush()
|
||||
{
|
||||
date_default_timezone_set('UTC');
|
||||
$this->if($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Adapter\Apns', '\Mock'))
|
||||
->and($this->mockClass(Apns::class, '\Mock'))
|
||||
->and($apnsAdapter = new \Mock\Apns())
|
||||
->and($apnsAdapter->getMockController()->push = true)
|
||||
->and($apnsAdapter->getMockController()->getResponse = new Response())
|
||||
|
||||
->and($this->mockGenerator()->orphanize('__construct'))
|
||||
->and($this->mockClass('\Sly\NotificationPusher\Model\Push', '\Mock'))
|
||||
->and($this->mockClass(Push::class, '\Mock'))
|
||||
->and($push = new \Mock\Push())
|
||||
->and($push->getMockController()->getMessage = new BaseMessage('Test'))
|
||||
->and($push->getMockController()->getDevices = new BaseDeviceCollection([new BaseDevice(self::APNS_TOKEN_EXAMPLE)]))
|
||||
->and($push->getMockController()->getMessage = new Message('Test'))
|
||||
->and($push->getMockController()->getDevices = new DeviceCollection([new Device(self::APNS_TOKEN_EXAMPLE)]))
|
||||
->and($push->getMockController()->getAdapter = $apnsAdapter)
|
||||
|
||||
->and($object = new TestedModel())
|
||||
->and($object->add($push))
|
||||
|
||||
->object($object->push())
|
||||
->isInstanceOf('\Sly\NotificationPusher\Collection\PushCollection')
|
||||
->hasSize(1)
|
||||
->isInstanceOf(PushCollection::class)
|
||||
->hasSize(1)
|
||||
->object($object->getResponse())
|
||||
->isInstanceOf('\Sly\NotificationPusher\Model\Response')
|
||||
;
|
||||
->isInstanceOf(Response::class);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user