From 894580215a28cac455c54b2d2659f5915d75f011 Mon Sep 17 00:00:00 2001 From: vEnCa-X Date: Fri, 30 Oct 2020 11:31:56 +0100 Subject: [PATCH 01/10] Fix CS. Upgrade nette/coding-standard to v3.0.0 --- .travis.yml | 2 +- Gruntfile.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ec56874..1b7147a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ jobs: script: - php temp/code-checker/code-checker -d src -d tests --short-arrays --strict-types - - php temp/coding-standard/ecs check src tests --config temp/coding-standard/coding-standard-php71.yml + - php temp/coding-standard/ecs check src tests --preset php71 - stage: Code Coverage diff --git a/Gruntfile.js b/Gruntfile.js index e834ba9..1ab9cce 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -31,10 +31,10 @@ module.exports = function (grunt) { command: 'php ..\\..\\nette-code-checker\\code-checker -d src -d tests --short-arrays --strict-types --fix' }, netteCodingStandard: { - command: 'php ..\\..\\nette-coding-standard\\ecs check src tests --config ..\\..\\nette-coding-standard\\coding-standard-php71.yml' + command: 'php ..\\..\\nette-coding-standard\\ecs check src tests --preset php71' }, netteCodingStandardFIX: { - command: 'php ..\\..\\nette-coding-standard\\ecs check src tests --config ..\\..\\nette-coding-standard\\coding-standard-php71.yml --fix' + command: 'php ..\\..\\nette-coding-standard\\ecs check src tests --preset php71 --fix' } } }); From c1c555ca64192f116f63fb8158ad93e94fcc1280 Mon Sep 17 00:00:00 2001 From: vEnCa-X Date: Fri, 30 Oct 2020 11:32:32 +0100 Subject: [PATCH 02/10] cs --- src/BaseLogin.php | 2 +- src/FacebookLogin.php | 18 ++++++++---------- src/GoogleLogin.php | 10 +++++++--- src/SocialLogin.php | 16 +++++++--------- src/TwitterLogin.php | 9 +++++++-- tests/tests/InstanceTest.phpt | 2 +- 6 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/BaseLogin.php b/src/BaseLogin.php index b1b50e9..400afd0 100644 --- a/src/BaseLogin.php +++ b/src/BaseLogin.php @@ -13,7 +13,7 @@ class BaseLogin /** @var array params */ protected $params; - /** @var String cookie name - save last used service for login */ + /** @var string cookie name - save last used service for login */ protected $cookieName; /** @var Nette\Http\IResponse */ diff --git a/src/FacebookLogin.php b/src/FacebookLogin.php index 7213e35..2731aaf 100644 --- a/src/FacebookLogin.php +++ b/src/FacebookLogin.php @@ -140,14 +140,12 @@ class FacebookLogin extends BaseLogin private $callBackUrl = ''; - /** - * @param $params array - data from config.neon - * @param $cookieName String cookie name - * @param Nette\Http\IResponse $httpResponse - * @param Nette\Http\IRequest $httpRequest - */ - public function __construct($params, $cookieName, Nette\Http\IResponse $httpResponse, Nette\Http\IRequest $httpRequest) - { + public function __construct( + $params, + $cookieName, + Nette\Http\IResponse $httpResponse, + Nette\Http\IRequest $httpRequest + ) { $this->params = $params; $this->cookieName = $cookieName; $this->httpResponse = $httpResponse; @@ -155,7 +153,7 @@ public function __construct($params, $cookieName, Nette\Http\IResponse $httpResp $this->callBackUrl = $this->params['callbackURL']; $default_graph_version = self::DEFAULT_FB_GRAPH_VERSION; - if (array_key_exists ('defaultFbGraphVersion', $this->params) && $this->params['defaultFbGraphVersion'] != '') { + if (array_key_exists('defaultFbGraphVersion', $this->params) && $this->params['defaultFbGraphVersion'] != '') { //set users defaultFbGraphVersion $default_graph_version = $this->params['defaultFbGraphVersion']; } @@ -216,7 +214,7 @@ public function getMe($fields) if ($fields == '' || !is_array($fields) || count($fields) == 0) { //array is empty - $fields = [self::ID];//set ID field + $fields = [self::ID]; //set ID field } try { diff --git a/src/GoogleLogin.php b/src/GoogleLogin.php index 08d70a7..0ee7f3c 100644 --- a/src/GoogleLogin.php +++ b/src/GoogleLogin.php @@ -25,14 +25,18 @@ class GoogleLogin extends BaseLogin * @param Nette\Http\IResponse $httpResponse * @param Nette\Http\IRequest $httpRequest */ - public function __construct($params, $cookieName, Nette\Http\IResponse $httpResponse, Nette\Http\IRequest $httpRequest) - { + public function __construct( + $params, + $cookieName, + Nette\Http\IResponse $httpResponse, + Nette\Http\IRequest $httpRequest + ) { $this->params = $params; $this->cookieName = $cookieName; $this->httpResponse = $httpResponse; $this->httpRequest = $httpRequest; - $this->client = new Google\Client(); + $this->client = new Google\Client; $this->client->setClientId($this->params['clientId']); $this->client->setClientSecret($this->params['clientSecret']); diff --git a/src/SocialLogin.php b/src/SocialLogin.php index e2c6e7d..9619a7c 100644 --- a/src/SocialLogin.php +++ b/src/SocialLogin.php @@ -18,15 +18,13 @@ class SocialLogin extends BaseLogin public $twitter; - /** - * @param $params params from cnofig.neon - * @param $params $cookieName cookie name - save last used service for login - * @param Nette\Http\IResponse $httpResponse - * @param Nette\Http\IRequest $httpRequest - * @param Nette\Http\Session $session - */ - public function __construct($params, $cookieName, Nette\Http\IResponse $httpResponse, Nette\Http\IRequest $httpRequest, Nette\Http\Session $session) - { + public function __construct( + $params, + $cookieName, + Nette\Http\IResponse $httpResponse, + Nette\Http\IRequest $httpRequest, + Nette\Http\Session $session + ) { $this->params = $params; $this->cookieName = $cookieName; $this->httpResponse = $httpResponse; diff --git a/src/TwitterLogin.php b/src/TwitterLogin.php index 53ebe90..975f64b 100644 --- a/src/TwitterLogin.php +++ b/src/TwitterLogin.php @@ -36,8 +36,13 @@ class TwitterLogin extends BaseLogin * @param Nette\Http\IResponse $httpResponse * @param Nette\Http\IRequest $httpRequest */ - public function __construct($params, $cookieName, Nette\Http\Session $session, Nette\Http\IResponse $httpResponse, Nette\Http\IRequest $httpRequest) - { + public function __construct( + $params, + $cookieName, + Nette\Http\Session $session, + Nette\Http\IResponse $httpResponse, + Nette\Http\IRequest $httpRequest + ) { $this->params = $params; $this->cookieName = $cookieName; $this->session = $session; diff --git a/tests/tests/InstanceTest.phpt b/tests/tests/InstanceTest.phpt index b6ea8d2..5790e94 100644 --- a/tests/tests/InstanceTest.phpt +++ b/tests/tests/InstanceTest.phpt @@ -65,5 +65,5 @@ class InstanceTest extends Tester\TestCase } } -$test = new InstanceTest(); +$test = new InstanceTest; $test->run(); From 51a97b94488c6d626a6b5f675ffc0e59dd55f36d Mon Sep 17 00:00:00 2001 From: vEnCa-X Date: Fri, 30 Oct 2020 15:09:18 +0100 Subject: [PATCH 03/10] Remove duplicit init bootsrap --- tests/tests/InstanceTest.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tests/InstanceTest.phpt b/tests/tests/InstanceTest.phpt index 5790e94..b5027d4 100644 --- a/tests/tests/InstanceTest.phpt +++ b/tests/tests/InstanceTest.phpt @@ -7,7 +7,7 @@ use Tester; use Tester\Assert; use VencaX; -$container = require __DIR__ . '/bootstrap.php'; +require __DIR__ . '/../../vendor/autoload.php'; class InstanceTest extends Tester\TestCase { From b2fd73c0a762cc34b44b2ae795cfb61875c47b75 Mon Sep 17 00:00:00 2001 From: vEnCa-X Date: Sat, 31 Oct 2020 09:13:32 +0100 Subject: [PATCH 04/10] Improve tests --- .travis.yml | 2 +- Gruntfile.js | 2 +- tests/php.ini | 5 +++++ tests/tests/InstanceTest.phpt | 9 ++++++++- 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 tests/php.ini diff --git a/.travis.yml b/.travis.yml index 1b7147a..69e947c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ install: - travis_retry composer install --no-progress --prefer-dist script: - - vendor/bin/tester tests -s + - vendor/bin/tester -c tests/php.ini -s tests after_failure: # Print *.actual content diff --git a/Gruntfile.js b/Gruntfile.js index 1ab9cce..ec14256 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -18,7 +18,7 @@ module.exports = function (grunt) { command: 'composer update --no-progress --prefer-dist --prefer-lowest --prefer-stable' }, test: { - command: 'vendor\\bin\\tester tests -s -p php' + command: 'vendor\\bin\\tester -c tests/php.ini -s tests' }, installCodeSoft: { command: 'composer create-project nette/coding-standard nette-coding-standard', diff --git a/tests/php.ini b/tests/php.ini new file mode 100644 index 0000000..27f503b --- /dev/null +++ b/tests/php.ini @@ -0,0 +1,5 @@ +[PHP] + +extension=curl + +memory_limit=512M \ No newline at end of file diff --git a/tests/tests/InstanceTest.phpt b/tests/tests/InstanceTest.phpt index b5027d4..4e8044d 100644 --- a/tests/tests/InstanceTest.phpt +++ b/tests/tests/InstanceTest.phpt @@ -29,6 +29,9 @@ class InstanceTest extends Tester\TestCase $urlParseArray = parse_url($url); parse_str($urlParseArray['query'], $urlParseQueryArray); + //Assert::same(false, $this->socialLogin->facebook->getSocialLoginCookie()); + Assert::same(false, $this->socialLogin->facebook->isThisServiceLastLogin()); + Assert::same('https', $urlParseArray['scheme']); Assert::same('www.facebook.com', $urlParseArray['host']); Assert::same('/v8.0/dialog/oauth', $urlParseArray['path']); @@ -47,6 +50,9 @@ class InstanceTest extends Tester\TestCase $urlParseArray = parse_url($url); parse_str($urlParseArray['query'], $urlParseQueryArray); + //Assert::same(false, $this->socialLogin->google->getSocialLoginCookie()); + Assert::same(false, $this->socialLogin->google->isThisServiceLastLogin()); + Assert::same('https', $urlParseArray['scheme']); Assert::same('accounts.google.com', $urlParseArray['host']); Assert::same('/o/oauth2/auth', $urlParseArray['path']); @@ -61,7 +67,8 @@ class InstanceTest extends Tester\TestCase public function testTwitterLoginUrl() { //$url = $this->socialLogin->twitter->getLoginUrl(); - Assert::same(true, true); + //Assert::same(false, $this->socialLogin->twitter->getSocialLoginCookie()); + Assert::same(false, $this->socialLogin->twitter->isThisServiceLastLogin()); } } From 0e1d8ba6444ab99dc9215995dfa05b2c79b7b026 Mon Sep 17 00:00:00 2001 From: vEnCa-X Date: Sat, 31 Oct 2020 09:20:11 +0100 Subject: [PATCH 05/10] CS --- tests/php.ini | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/php.ini b/tests/php.ini index 27f503b..2f9b727 100644 --- a/tests/php.ini +++ b/tests/php.ini @@ -1,5 +1,3 @@ [PHP] extension=curl - -memory_limit=512M \ No newline at end of file From eff7b41e6085b874ec0a82569f52eb61fc1b0cc3 Mon Sep 17 00:00:00 2001 From: vEnCa-X Date: Mon, 14 Dec 2020 18:36:18 +0100 Subject: [PATCH 06/10] Stable abraham/twitteroauth --- README.md | 2 +- composer.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index adc2c48..a9c498b 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Nette addon for login with social networks | Version | Facebook App API | PHP | Recommended Nette | | --- | --- | --- | --- | -| dev-master | 8.0 or own | \>= 7.1 | Nette 3.0 | +| dev-master | 8.0 or own | \>= 7.2 | Nette 3.0 | | 1.2.x | 8.0 or own | \>= 7.1 | Nette 3.0 | | 1.1.x | 2.6 | \>= 7.0 | Nette 2.4 (Nette\SmartObject) | | 1.0.x | 2.6 | \>= 5.5 | Nette 2.4, 2.3 (Nette\Object) | diff --git a/composer.json b/composer.json index e7ad746..c4d6542 100644 --- a/composer.json +++ b/composer.json @@ -18,11 +18,11 @@ } ], "require": { - "php": ">=7.1", + "php": ">=7.2", "nette/application": "^3.0", "facebook/graph-sdk": "^5.6", "google/apiclient": "^2.8", - "kertz/twitteroauth": "dev-master" + "abraham/twitteroauth": "^2.0.0" }, "require-dev": { "nette/robot-loader": "^3.0", From 337dbfff1eb1b9b525720100ff31ec05ecb13fc7 Mon Sep 17 00:00:00 2001 From: vEnCa-X Date: Mon, 14 Dec 2020 21:45:03 +0100 Subject: [PATCH 07/10] minimum version PHP is 7.2 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 69e947c..2494b07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: php php: - - 7.1 - 7.2 - 7.3 - 7.4 From 9d3ab33827cfd36fa744b74c446f7227c4b381db Mon Sep 17 00:00:00 2001 From: vEnCa-X Date: Tue, 15 Dec 2020 22:08:48 +0100 Subject: [PATCH 08/10] Add tests for PHP 8.0 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2494b07..c59b79a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ php: - 7.2 - 7.3 - 7.4 + - 8.0 before_install: # turn off XDebug From 62d835cbb6843d7b26a940cc0d45731901c5f72d Mon Sep 17 00:00:00 2001 From: vEnCa-X Date: Sun, 20 Dec 2020 09:57:44 +0100 Subject: [PATCH 09/10] facebook/graph-sdk is not compatible with php8.0 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c59b79a..2494b07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ php: - 7.2 - 7.3 - 7.4 - - 8.0 before_install: # turn off XDebug From 3487d276fc6b0709c76ac5f9e32385f5ef804192 Mon Sep 17 00:00:00 2001 From: vEnCa-X Date: Sun, 20 Dec 2020 10:21:08 +0100 Subject: [PATCH 10/10] Switch from travis-ci.org to travis-ci.com --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a9c498b..131426f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ social-login =============== -[![Build Status](https://travis-ci.org/venca-x/social-login.svg)](https://travis-ci.org/venca-x/social-login) +[![Build Status](https://travis-ci.com/venca-x/social-login.svg)](https://travis-ci.com/venca-x/social-login) [![Coverage Status](https://coveralls.io/repos/github/venca-x/social-login/badge.svg?branch=master)](https://coveralls.io/github/venca-x/social-login?branch=master) [![Latest Stable Version](https://poser.pugx.org/venca-x/social-login/v/stable.svg)](https://packagist.org/packages/venca-x/social-login) [![Latest Unstable Version](https://poser.pugx.org/venca-x/social-login/v/unstable.svg)](https://packagist.org/packages/venca-x/social-login)