diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 67237c1..9a74db8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,4 +6,6 @@ Summary of changes proposed in this Pull Request: - PR checklist: +- [ ] Updated relevant documentation - [ ] Updated CHANGELOG.md +- [ ] Added tests for my change \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7aedc83..a0ee665 100755 --- a/.gitignore +++ b/.gitignore @@ -70,3 +70,13 @@ crashlytics.properties crashlytics-build.properties fabric.properties +# composer +/vendor/ +composer.phar + +# Project +phpunit.phar +.phpunit.result.cache +phpunit.xml +/build/ +.env diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2ad276c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,27 @@ +language: php + +sudo: false + +php: + - 7.1 + - 7.2 + - 7.3 + +branches: + only: + - master + - fb-travis-ci + +before_script: + - travis_retry composer self-update + - travis_retry composer install --no-interaction --prefer-source + +script: + - vendor/bin/phpunit + +after_success: + - bash <(curl -s https://codecov.io/bash) + +cache: + directories: + - $HOME/.composer/cache diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c2389a..6773b9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,12 @@ ## v1.2.3 (in development) ### New features & improvements: +- Update required php version to 7.1.3 (https://www.php.net/supported-versions.php) +- Add descriptions +- Add tests ### Bug fixes: +- Add missing ";" ## v1.2.2 (release date: 13th April 2019) diff --git a/FbBotApp.php b/FbBotApp.php index b880693..0cc3c19 100755 --- a/FbBotApp.php +++ b/FbBotApp.php @@ -580,6 +580,4 @@ public function getCurlError() { return $this->curl_error; } - - } diff --git a/Menu/LocalizedMenu.php b/Menu/LocalizedMenu.php index 83b74d8..50ce245 100755 --- a/Menu/LocalizedMenu.php +++ b/Menu/LocalizedMenu.php @@ -8,13 +8,19 @@ */ class LocalizedMenu { + private $locale; - private $locale ; - - private $composer_input_disabled ; + private $composer_input_disabled; private $menuItems; + /** + * LocalizedMenu constructor. + * + * @param string $locale + * @param boolean $composer_input_disabled + * @param null|array $menuItems + */ public function __construct($locale, $composer_input_disabled, $menuItems = null) { $this->locale = $locale; diff --git a/Menu/MenuItem.php b/Menu/MenuItem.php index 45f5964..fdd6d13 100755 --- a/Menu/MenuItem.php +++ b/Menu/MenuItem.php @@ -28,14 +28,14 @@ class MenuItem * * @var string */ - protected $type ; + protected $type; /** * Button title * * @var string */ - protected $title ; + protected $title; /** * Button url @@ -70,14 +70,14 @@ class MenuItem * * @var null|string */ - protected $webview_share_button = null ; + protected $webview_share_button = null; /** * MessageButton constructor. * * @param string $type * @param string $title - * @param string $url url or postback + * @param string|array $data */ public function __construct($type, $title, $data, $webview_height_ratio = '', $messenger_extensions = false, $fallback_url = '', $webview_share_button = null) { @@ -133,4 +133,4 @@ public function getData() } return $result; } -} \ No newline at end of file +} diff --git a/Messages/AccountLink.php b/Messages/AccountLink.php index f4feed9..2a076ba 100755 --- a/Messages/AccountLink.php +++ b/Messages/AccountLink.php @@ -8,7 +8,6 @@ */ class AccountLink { - /** * Link Account title * @@ -49,8 +48,9 @@ class AccountLink * @param string $subtitle * @param string $url button url * @param string $image_url + * @param boolean $logout */ - public function __construct($title, $subtitle = '', $url = '', $image_url = '', $logout = FALSE) + public function __construct($title, $subtitle = '', $url = '', $image_url = '', $logout = false) { $this->title = $title; $this->subtitle = $subtitle; @@ -68,11 +68,11 @@ public function getData() { if($this->logout) { - $buttons = new MessageButton( MessageButton::TYPE_ACCOUNT_UNLINK, ''); + $buttons = new MessageButton(MessageButton::TYPE_ACCOUNT_UNLINK, ''); } else { - $buttons = new MessageButton( MessageButton::TYPE_ACCOUNT_LINK, '', $this->url); + $buttons = new MessageButton(MessageButton::TYPE_ACCOUNT_LINK, '', $this->url); } $result = [ @@ -81,7 +81,7 @@ public function getData() 'image_url' => $this->image_url, 'buttons' => [$buttons->getData()] ]; + return $result; } - } diff --git a/Messages/Address.php b/Messages/Address.php index fecd8df..e726baa 100755 --- a/Messages/Address.php +++ b/Messages/Address.php @@ -33,4 +33,4 @@ public function getData() { return $this->data; } -} \ No newline at end of file +} diff --git a/Messages/Adjustment.php b/Messages/Adjustment.php index fac4909..befeaf6 100755 --- a/Messages/Adjustment.php +++ b/Messages/Adjustment.php @@ -33,4 +33,4 @@ public function getData() { return $this->data; } -} \ No newline at end of file +} diff --git a/Messages/MessageButton.php b/Messages/MessageButton.php index 15612f1..3417b6a 100755 --- a/Messages/MessageButton.php +++ b/Messages/MessageButton.php @@ -140,45 +140,44 @@ public function getData() case self::TYPE_POSTBACK: $result['title'] = $this->title; $result['payload'] = $this->url; - break; + break; case self::TYPE_CALL: $result['title'] = $this->title; $result['payload'] = $this->url; - break; + break; case self::TYPE_WEB: - $result['title'] = $this->title; - $result['url'] = $this->url; - - if ($this->webview_height_ratio) { - $result['webview_height_ratio'] = $this->webview_height_ratio; - } - - if ($this->messenger_extensions){ - $result['messenger_extensions'] = $this->messenger_extensions; - $result['fallback_url'] = $this->fallback_url; - } - - if($this->webview_share_button){ - $result['webview_share_button'] = $this->webview_share_button ; - } - break; + $result['title'] = $this->title; + $result['url'] = $this->url; + + if ($this->webview_height_ratio) { + $result['webview_height_ratio'] = $this->webview_height_ratio; + } + + if ($this->messenger_extensions){ + $result['messenger_extensions'] = $this->messenger_extensions; + $result['fallback_url'] = $this->fallback_url; + } + + if($this->webview_share_button){ + $result['webview_share_button'] = $this->webview_share_button; + } + break; case self::TYPE_SHARE: - //only share_contents needed - if ($this->share_contents) - $result['share_contents'] = $this->share_contents->getData(); - break; + //only share_contents needed + if ($this->share_contents) + $result['share_contents'] = $this->share_contents->getData(); + break; case self::TYPE_ACCOUNT_LINK: $result['url'] = $this->url; - break; + break; case self::TYPE_ACCOUNT_UNLINK: - //only type needed - break; - + //only type needed + break; } return $result; diff --git a/Messages/MessageReceiptElement.php b/Messages/MessageReceiptElement.php index c17190b..d80ee81 100755 --- a/Messages/MessageReceiptElement.php +++ b/Messages/MessageReceiptElement.php @@ -59,4 +59,4 @@ public function getData() 'currency' => $this->currency ]; } -} \ No newline at end of file +} diff --git a/Messages/SenderAction.php b/Messages/SenderAction.php index 61ee7f7..a69919d 100755 --- a/Messages/SenderAction.php +++ b/Messages/SenderAction.php @@ -55,4 +55,4 @@ public function getData() 'sender_action' => $this->action ]; } -} \ No newline at end of file +} diff --git a/Messages/Summary.php b/Messages/Summary.php index e090986..3c4e551 100755 --- a/Messages/Summary.php +++ b/Messages/Summary.php @@ -33,4 +33,4 @@ public function getData() { return $this->data; } -} \ No newline at end of file +} diff --git a/README.md b/README.md index 8fa01fb..a3eeba4 100755 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![Build Status](https://travis-ci.com/pimax/fb-messenger-php.svg?branch=master)](https://travis-ci.com/pimax/fb-messenger-php) +[![Coverage badge](https://codecov.io/gh/pimax/fb-messenger-php/branch/master/graphs/badge.svg)](https://codecov.io/gh/pimax/fb-messenger-php) + FB Messenger Bot PHP API ======================== @@ -10,8 +13,12 @@ The minimum requirement is that your Web server supports PHP 5.4. INSTALLATION ------------ +Version 1.2.2 is the last with PHP ">=5.4.0" support. +**As of version 2.0, PHP 7.1.3 is required.** + ``` composer require "pimax/fb-messenger-php" "dev-master" +composer require "pimax/fb-messenger-php" "" ``` BASIC USAGE diff --git a/composer.json b/composer.json index e47923f..67172ca 100755 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "pimax/fb-messenger-php", - "description": " Facebook Messenger Bot PHP API", + "description": "Facebook Messenger Bot PHP API", "homepage": "https://github.com/pimax/fb-messenger-php", "license": "MIT", "authors": [ @@ -12,10 +12,15 @@ } ], "require": { - "php": ">=5.4.0" + "php": "^7.1.3" + }, + "require-dev": { + "phpunit/phpunit": "^7.3" }, - "autoload": { "psr-4": { "pimax\\": "" } + }, + "scripts": { + "test": "phpunit" } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..37c9075 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1492 @@ +{ + "_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#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "fd8b0485d6bebcbff8757aa5f00d2135", + "packages": [], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "a2c590166b2133a4633738648b6b064edae0814a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", + "reference": "a2c590166b2133a4633738648b6b064edae0814a", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2019-03-17T17:37:11+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.9.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2019-04-07T13:18:21+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2017-09-11T18:02:19+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", + "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2019-04-30T17:48:53+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2017-07-14T14:27:02+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2018-08-05T17:53:17+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "6.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1 || ^4.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2018-10-31T16:06:48+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "050bedf145a257b1ff02746c31894800e5122946" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2018-09-13T20:33:42+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "8b389aebe1b8b0578430bda0c7c95a829608e059" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b389aebe1b8b0578430bda0c7c95a829608e059", + "reference": "8b389aebe1b8b0578430bda0c7c95a829608e059", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2019-02-20T10:12:59+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c99e3be9d3e85f60646f152f9002d46ed7770d18", + "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2018-10-30T05:52:18+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "7.5.9", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "134669cf0eeac3f79bc7f0c793efbc158bffc160" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/134669cf0eeac3f79bc7f0c793efbc158bffc160", + "reference": "134669cf0eeac3f79bc7f0c793efbc158bffc160", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpunit/phpunit-mock-objects": "*" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2019-04-19T15:50:46+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "shasum": "" + }, + "require": { + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-07-12T15:12:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "time": "2019-02-04T06:01:07+00:00" + }, + { + "name": "sebastian/environment", + "version": "4.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "3095910f0f0fb155ac4021fc51a4a7a39ac04e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/3095910f0f0fb155ac4021fc51a4a7a39ac04e8a", + "reference": "3095910f0f0fb155ac4021fc51a4a7a39ac04e8a", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2019-04-25T07:55:20+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2017-04-03T13:19:02+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2018-10-04T04:07:39+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "82ebae02209c21113908c229e9883c419720738a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", + "reference": "82ebae02209c21113908c229e9883c419720738a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-02-06T07:57:58+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/1c42705be2b6c1de5904f8afacef5895cab44bf8", + "reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2019-04-04T09:56:43+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2018-12-25T11:19:39+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^7.1.3" + }, + "platform-dev": [] +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..7011dc8 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,30 @@ + + + + + ./tests/TestCase + + + + + + ./Messages + ./Menu + FbBotApp.php + UserProfile.php + + + + + + + diff --git a/tests/Mocks/Menu/LocalizedMenu/default.json b/tests/Mocks/Menu/LocalizedMenu/default.json new file mode 100644 index 0000000..d1153d6 --- /dev/null +++ b/tests/Mocks/Menu/LocalizedMenu/default.json @@ -0,0 +1,21 @@ +{ + "locale": "default", + "composer_input_disabled": false, + "call_to_actions": [ + { + "type": "postback", + "title": "title_1", + "payload": "PAYLOAD_1" + }, + { + "type": "postback", + "title": "title_2", + "payload": "PAYLOAD_2" + }, + { + "type": "postback", + "title": "title_3", + "payload": "PAYLOAD_3" + } + ] +} diff --git a/tests/Mocks/Menu/LocalizedMenu/default_no_items.json b/tests/Mocks/Menu/LocalizedMenu/default_no_items.json new file mode 100644 index 0000000..3ff807e --- /dev/null +++ b/tests/Mocks/Menu/LocalizedMenu/default_no_items.json @@ -0,0 +1,4 @@ +{ + "locale": "default", + "composer_input_disabled": false +} diff --git a/tests/Mocks/Menu/MenuItem/nested.json b/tests/Mocks/Menu/MenuItem/nested.json new file mode 100644 index 0000000..ad9d97a --- /dev/null +++ b/tests/Mocks/Menu/MenuItem/nested.json @@ -0,0 +1,21 @@ +{ + "type": "nested", + "title": "title", + "call_to_actions": [ + { + "type": "postback", + "title": "title_1", + "payload": "PAYLOAD_1" + }, + { + "type": "postback", + "title": "title_2", + "payload": "PAYLOAD_2" + }, + { + "type": "postback", + "title": "title_3", + "payload": "PAYLOAD_3" + } + ] +} diff --git a/tests/Mocks/Menu/MenuItem/postback.json b/tests/Mocks/Menu/MenuItem/postback.json new file mode 100644 index 0000000..7471e13 --- /dev/null +++ b/tests/Mocks/Menu/MenuItem/postback.json @@ -0,0 +1,5 @@ +{ + "type": "postback", + "title": "title", + "payload": "PAYLOAD" +} diff --git a/tests/Mocks/Menu/MenuItem/web.json b/tests/Mocks/Menu/MenuItem/web.json new file mode 100644 index 0000000..f970d21 --- /dev/null +++ b/tests/Mocks/Menu/MenuItem/web.json @@ -0,0 +1,9 @@ +{ + "type": "web_url", + "url": "https://github.com/pimax/fb-messenger-php/issues", + "title": "title", + "webview_height_ratio": "full", + "messenger_extensions": true, + "fallback_url": "https://github.com/pimax/fb-messenger-php", + "webview_share_button": "hide" +} diff --git a/tests/Mocks/Messages/AccountLink/link.json b/tests/Mocks/Messages/AccountLink/link.json new file mode 100644 index 0000000..4db090c --- /dev/null +++ b/tests/Mocks/Messages/AccountLink/link.json @@ -0,0 +1,11 @@ +{ + "title": "title", + "subtitle": "subtitle", + "image_url": "https://www.facebook.com/images/fb_icon_325x325.png", + "buttons": [ + { + "type": "account_link", + "url": "https://www.example.com/oauth/authorize" + } + ] +} diff --git a/tests/Mocks/Messages/AccountLink/unlink.json b/tests/Mocks/Messages/AccountLink/unlink.json new file mode 100644 index 0000000..7700ea8 --- /dev/null +++ b/tests/Mocks/Messages/AccountLink/unlink.json @@ -0,0 +1,10 @@ +{ + "title": "title", + "subtitle": "subtitle", + "image_url": "https://www.facebook.com/images/fb_icon_325x325.png", + "buttons": [ + { + "type": "account_unlink" + } + ] +} diff --git a/tests/Mocks/Messages/SenderAction/mark_seen.json b/tests/Mocks/Messages/SenderAction/mark_seen.json new file mode 100644 index 0000000..7426ad7 --- /dev/null +++ b/tests/Mocks/Messages/SenderAction/mark_seen.json @@ -0,0 +1,6 @@ +{ + "recipient": { + "id": "1234567890" + }, + "sender_action": "mark_seen" +} diff --git a/tests/Mocks/Messages/SenderAction/typing_off.json b/tests/Mocks/Messages/SenderAction/typing_off.json new file mode 100644 index 0000000..c0a3da9 --- /dev/null +++ b/tests/Mocks/Messages/SenderAction/typing_off.json @@ -0,0 +1,6 @@ +{ + "recipient": { + "id": "1234567890" + }, + "sender_action": "typing_off" +} diff --git a/tests/Mocks/Messages/SenderAction/typing_on.json b/tests/Mocks/Messages/SenderAction/typing_on.json new file mode 100644 index 0000000..f2dd686 --- /dev/null +++ b/tests/Mocks/Messages/SenderAction/typing_on.json @@ -0,0 +1,6 @@ +{ + "recipient": { + "id": "1234567890" + }, + "sender_action": "typing_on" +} diff --git a/tests/Mocks/Response/User/user.json b/tests/Mocks/Response/User/user.json new file mode 100644 index 0000000..324c55b --- /dev/null +++ b/tests/Mocks/Response/User/user.json @@ -0,0 +1,8 @@ +{ + "first_name": "Peter", + "last_name": "Chang", + "profile_pic": "https://placeimg.com/200/200/nature", + "locale": "en_US", + "timezone": -7, + "gender": "male" +} \ No newline at end of file diff --git a/tests/TestCase/AbstractTestCase.php b/tests/TestCase/AbstractTestCase.php new file mode 100644 index 0000000..9b585b0 --- /dev/null +++ b/tests/TestCase/AbstractTestCase.php @@ -0,0 +1,9 @@ +assertJsonStringEqualsJsonString($expectedJson, json_encode($localizedMenu->getData())); + } + + public function testLocalizedMenuWithoutItems(): void + { + $expectedJson = file_get_contents(__DIR__ . '/../../Mocks/Menu/LocalizedMenu/default_no_items.json'); + + $localizedMenu = new LocalizedMenu('default', false); + + $this->assertJsonStringEqualsJsonString($expectedJson, json_encode($localizedMenu->getData())); + } +} diff --git a/tests/TestCase/Menu/MenuItemTest.php b/tests/TestCase/Menu/MenuItemTest.php new file mode 100644 index 0000000..c539848 --- /dev/null +++ b/tests/TestCase/Menu/MenuItemTest.php @@ -0,0 +1,55 @@ +assertJsonStringEqualsJsonString($expectedJson, json_encode($menuItem->getData())); + } + + public function testItemWeb(): void + { + $expectedJson = file_get_contents(__DIR__ . '/../../Mocks/Menu/MenuItem/web.json'); + + $menuItem = new MenuItem( + MenuItem::TYPE_WEB, + 'title', + 'https://github.com/pimax/fb-messenger-php/issues', + 'full', + true, + 'https://github.com/pimax/fb-messenger-php', + 'hide' + ); + + $this->assertJsonStringEqualsJsonString($expectedJson, json_encode($menuItem->getData())); + } + + public function testItemNested(): void + { + $expectedJson = file_get_contents(__DIR__ . '/../../Mocks/Menu/MenuItem/nested.json'); + + $menuItem = new MenuItem( + MenuItem::TYPE_NESTED, + 'title', + [ + new MenuItem(MenuItem::TYPE_POSTBACK, 'title_1', 'PAYLOAD_1'), + new MenuItem(MenuItem::TYPE_POSTBACK, 'title_2', 'PAYLOAD_2'), + new MenuItem(MenuItem::TYPE_POSTBACK, 'title_3', 'PAYLOAD_3'), + ] + ); + + $this->assertJsonStringEqualsJsonString($expectedJson, json_encode($menuItem->getData())); + } +} diff --git a/tests/TestCase/Messages/AccountLinkTest.php b/tests/TestCase/Messages/AccountLinkTest.php new file mode 100644 index 0000000..544d07a --- /dev/null +++ b/tests/TestCase/Messages/AccountLinkTest.php @@ -0,0 +1,42 @@ +assertJsonStringEqualsJsonString($expectedJson, json_encode($accountLink->getData())); + } + + public function testAccountUnlink(): void + { + $expectedJson = file_get_contents(__DIR__ . '/../../Mocks/Messages/AccountLink/unlink.json'); + + $accountUnlink = new AccountLink( + $title='title', + $subtitle='subtitle', + $url='', + $image_url='https://www.facebook.com/images/fb_icon_325x325.png', + $logout=true + ); + + $this->assertJsonStringEqualsJsonString($expectedJson, json_encode($accountUnlink->getData())); + } +} diff --git a/tests/TestCase/Messages/SenderActionTest.php b/tests/TestCase/Messages/SenderActionTest.php new file mode 100644 index 0000000..baad816 --- /dev/null +++ b/tests/TestCase/Messages/SenderActionTest.php @@ -0,0 +1,39 @@ +assertJsonStringEqualsJsonString($expectedJson, json_encode($markSeen->getData())); + } + + public function testTypingOn(): void + { + $expectedJson = file_get_contents(__DIR__ . '/../../Mocks/Messages/SenderAction/typing_on.json'); + + $typingOn = new SenderAction('1234567890', SenderAction::ACTION_TYPING_ON); + + $this->assertJsonStringEqualsJsonString($expectedJson, json_encode($typingOn->getData())); + } + + public function testTypingOff(): void + { + $expectedJson = file_get_contents(__DIR__ . '/../../Mocks/Messages/SenderAction/typing_off.json'); + + $typingOff = new SenderAction('1234567890', SenderAction::ACTION_TYPING_OFF); + + $this->assertJsonStringEqualsJsonString($expectedJson, json_encode($typingOff->getData())); + } +} diff --git a/tests/TestCase/UserProfile/UserProfileTest.php b/tests/TestCase/UserProfile/UserProfileTest.php new file mode 100644 index 0000000..aca70dd --- /dev/null +++ b/tests/TestCase/UserProfile/UserProfileTest.php @@ -0,0 +1,41 @@ +data = file_get_contents(__DIR__ . '/../../Mocks/Response/User/user.json'); + + $this->userProfile = new UserProfile(json_decode($this->data, true)); + } + + public function testUserProfile(): void + { + $this->assertSame('Peter', $this->userProfile->getFirstName()); + $this->assertSame('Chang', $this->userProfile->getLastName()); + $this->assertSame('https://placeimg.com/200/200/nature', $this->userProfile->getPicture()); + $this->assertSame('en_US', $this->userProfile->getLocale()); + $this->assertSame(-7, $this->userProfile->getTimezone()); + $this->assertSame('male', $this->userProfile->getGender()); + } + + public function testUserProfileData(): void + { + $this->assertJsonStringEqualsJsonString($this->data, json_encode($this->userProfile->getData())); + } +}