From 5ac90e18754bde0c3b2954fca2fac809f159b13d Mon Sep 17 00:00:00 2001 From: Tyler Cosgrove Date: Wed, 6 Dec 2017 12:40:26 -0500 Subject: [PATCH 1/3] Update lusitanian/oauth dependency --- composer.lock | 10 +- vendor/composer/ClassLoader.php | 10 +- vendor/composer/LICENSE | 2 +- vendor/composer/installed.json | 12 +- vendor/lusitanian/oauth/.gitignore | 6 - vendor/lusitanian/oauth/.scrutinizer.yml | 37 - vendor/lusitanian/oauth/.travis.yml | 22 - vendor/lusitanian/oauth/README.md | 2 + vendor/lusitanian/oauth/examples/amazon.php | 52 - .../lusitanian/oauth/examples/bitbucket.php | 64 -- vendor/lusitanian/oauth/examples/bitly.php | 53 -- vendor/lusitanian/oauth/examples/bitrix24.php | 56 -- .../lusitanian/oauth/examples/bootstrap.php | 29 - vendor/lusitanian/oauth/examples/box.php | 58 -- vendor/lusitanian/oauth/examples/buffer.php | 53 -- .../lusitanian/oauth/examples/dailymotion.php | 52 - vendor/lusitanian/oauth/examples/deezer.php | 52 - .../lusitanian/oauth/examples/delicious.php | 59 -- .../lusitanian/oauth/examples/deviantart.php | 54 -- vendor/lusitanian/oauth/examples/dropbox.php | 52 - vendor/lusitanian/oauth/examples/etsy.php | 59 -- .../lusitanian/oauth/examples/eveonline.php | 55 -- vendor/lusitanian/oauth/examples/facebook.php | 57 -- vendor/lusitanian/oauth/examples/fitbit.php | 61 -- .../oauth/examples/fiveHundredPx.php | 61 -- vendor/lusitanian/oauth/examples/flickr.php | 80 -- .../lusitanian/oauth/examples/foursquare.php | 53 -- vendor/lusitanian/oauth/examples/github.php | 52 - vendor/lusitanian/oauth/examples/google.php | 56 -- vendor/lusitanian/oauth/examples/harvest.php | 74 -- vendor/lusitanian/oauth/examples/hubic.php | 62 -- .../oauth/examples/init.example.php | 204 ---- .../lusitanian/oauth/examples/instagram.php | 59 -- vendor/lusitanian/oauth/examples/jawbone.php | 52 - vendor/lusitanian/oauth/examples/linkedin.php | 57 -- .../lusitanian/oauth/examples/mailchimp.php | 55 -- .../lusitanian/oauth/examples/microsoft.php | 49 - vendor/lusitanian/oauth/examples/nest.php | 50 - vendor/lusitanian/oauth/examples/netatmo.php | 53 -- .../oauth/examples/parrotFlowerPower.php | 52 - vendor/lusitanian/oauth/examples/paypal.php | 52 - .../lusitanian/oauth/examples/pinterest.php | 51 - vendor/lusitanian/oauth/examples/pocket.php | 63 -- .../lusitanian/oauth/examples/quickbooks.php | 67 -- vendor/lusitanian/oauth/examples/reddit.php | 54 -- vendor/lusitanian/oauth/examples/redmine.php | 62 -- .../lusitanian/oauth/examples/runkeeper.php | 51 - vendor/lusitanian/oauth/examples/scoopit.php | 57 -- .../lusitanian/oauth/examples/soundcloud.php | 53 -- vendor/lusitanian/oauth/examples/spotify.php | 53 -- vendor/lusitanian/oauth/examples/strava.php | 61 -- vendor/lusitanian/oauth/examples/tumblr.php | 62 -- vendor/lusitanian/oauth/examples/twitter.php | 62 -- vendor/lusitanian/oauth/examples/ustream.php | 54 -- vendor/lusitanian/oauth/examples/vimeo.php | 52 - vendor/lusitanian/oauth/examples/yahoo.php | 57 -- vendor/lusitanian/oauth/examples/yammer.php | 58 -- .../src/OAuth/OAuth2/Service/BattleNet.php | 116 +++ .../src/OAuth/OAuth2/Service/Bitrix24.php | 8 + .../src/OAuth/OAuth2/Service/Facebook.php | 8 +- .../oauth/src/OAuth/OAuth2/Service/Google.php | 4 +- .../oauth/src/OAuth/OAuth2/Service/Mondo.php | 86 ++ .../src/OAuth/OAuth2/Service/Salesforce.php | 2 +- .../Mocks/Common/FakeProject/NS/SomeClass.php | 11 - .../oauth/tests/Mocks/Common/Service/Mock.php | 60 -- .../oauth/tests/Mocks/OAuth1/Service/Fake.php | 57 -- .../oauth/tests/Mocks/OAuth1/Service/Mock.php | 35 - .../oauth/tests/Mocks/OAuth2/Service/Fake.php | 32 - .../oauth/tests/Mocks/OAuth2/Service/Mock.php | 58 -- .../tests/Unit/Common/AutoloaderTest.php | 126 --- .../Unit/Common/Consumer/CredentialsTest.php | 51 - .../Common/Http/Client/AbstractClientTest.php | 67 -- .../Common/Http/Client/CurlClientTest.php | 386 -------- .../Common/Http/Client/StreamClientTest.php | 283 ------ .../Unit/Common/Http/HttpClientsTest.php | 171 ---- .../Unit/Common/Http/Uri/UriFactoryTest.php | 331 ------- .../tests/Unit/Common/Http/Uri/UriTest.php | 898 ------------------ .../Common/Service/AbstractServiceTest.php | 171 ---- .../tests/Unit/Common/Storage/MemoryTest.php | 132 --- .../tests/Unit/Common/Storage/RedisTest.php | 102 -- .../tests/Unit/Common/Storage/SessionTest.php | 245 ----- .../tests/Unit/Common/Storage/StorageTest.php | 74 -- .../Common/Storage/SymfonySessionTest.php | 111 --- .../Unit/Common/Token/AbstractTokenTest.php | 189 ---- .../OAuth1/Service/AbstractServiceTest.php | 242 ----- .../Unit/OAuth1/Service/BitBucketTest.php | 278 ------ .../tests/Unit/OAuth1/Service/EtsyTest.php | 286 ------ .../tests/Unit/OAuth1/Service/FitBitTest.php | 278 ------ .../Unit/OAuth1/Service/FiveHundredPx.php | 278 ------ .../tests/Unit/OAuth1/Service/FlickrTest.php | 302 ------ .../Unit/OAuth1/Service/QuickBooksTest.php | 212 ----- .../tests/Unit/OAuth1/Service/ScoopItTest.php | 302 ------ .../tests/Unit/OAuth1/Service/TumblrTest.php | 278 ------ .../tests/Unit/OAuth1/Service/TwitterTest.php | 383 -------- .../tests/Unit/OAuth1/Service/XingTest.php | 239 ----- .../tests/Unit/OAuth1/Service/YahooTest.php | 302 ------ .../Unit/OAuth1/Signature/SignatureTest.php | 325 ------- .../Unit/OAuth1/Token/StdOAuth1TokenTest.php | 85 -- .../OAuth2/Service/AbstractServiceTest.php | 401 -------- .../tests/Unit/OAuth2/Service/AmazonTest.php | 207 ---- .../tests/Unit/OAuth2/Service/BitlyTest.php | 150 --- .../tests/Unit/OAuth2/Service/Bitrix24.php | 178 ---- .../tests/Unit/OAuth2/Service/BoxTest.php | 207 ---- .../tests/Unit/OAuth2/Service/BufferTest.php | 150 --- .../Unit/OAuth2/Service/DailymotionTest.php | 230 ----- .../tests/Unit/OAuth2/Service/DeezerTest.php | 175 ---- .../Unit/OAuth2/Service/DeliciousTest.php | 165 ---- .../Unit/OAuth2/Service/DeviantArtTest.php | 166 ---- .../tests/Unit/OAuth2/Service/DropboxTest.php | 231 ----- .../Unit/OAuth2/Service/EveOnlineTest.php | 209 ---- .../Unit/OAuth2/Service/FacebookTest.php | 242 ----- .../Unit/OAuth2/Service/FoursquareTest.php | 225 ----- .../tests/Unit/OAuth2/Service/GitHubTest.php | 220 ----- .../tests/Unit/OAuth2/Service/GoogleTest.php | 195 ---- .../tests/Unit/OAuth2/Service/HerokuTest.php | 261 ----- .../tests/Unit/OAuth2/Service/HubicTest.php | 165 ---- .../Unit/OAuth2/Service/InstagramTest.php | 193 ---- .../Unit/OAuth2/Service/JawboneUPTest.php | 207 ---- .../Unit/OAuth2/Service/LinkedinTest.php | 212 ----- .../Unit/OAuth2/Service/MailchimpTest.php | 179 ---- .../Unit/OAuth2/Service/MicrosoftTest.php | 193 ---- .../tests/Unit/OAuth2/Service/NestTest.php | 212 ----- .../tests/Unit/OAuth2/Service/NetatmoTest.php | 165 ---- .../OAuth2/Service/ParrotFlowerPowerTest.php | 165 ---- .../tests/Unit/OAuth2/Service/PaypalTest.php | 213 ----- .../Unit/OAuth2/Service/PinterestTest.php | 195 ---- .../tests/Unit/OAuth2/Service/RedditTest.php | 193 ---- .../Unit/OAuth2/Service/RunKeeperTest.php | 207 ---- .../Unit/OAuth2/Service/SoundCloudTest.php | 159 ---- .../tests/Unit/OAuth2/Service/SpotifyTest.php | 214 ----- .../tests/Unit/OAuth2/Service/StravaTest.php | 177 ---- .../tests/Unit/OAuth2/Service/UstreamTest.php | 193 ---- .../tests/Unit/OAuth2/Service/VimeoTest.php | 193 ---- .../Unit/OAuth2/Service/VkontakteTest.php | 159 ---- .../tests/Unit/OAuth2/Service/YahooTest.php | 214 ----- .../tests/Unit/OAuth2/Service/YammerTest.php | 187 ---- .../oauth/tests/Unit/ServiceFactoryTest.php | 311 ------ vendor/lusitanian/oauth/tests/bootstrap.php | 42 - 138 files changed, 241 insertions(+), 18328 deletions(-) delete mode 100644 vendor/lusitanian/oauth/.gitignore delete mode 100644 vendor/lusitanian/oauth/.scrutinizer.yml delete mode 100644 vendor/lusitanian/oauth/.travis.yml delete mode 100644 vendor/lusitanian/oauth/examples/amazon.php delete mode 100644 vendor/lusitanian/oauth/examples/bitbucket.php delete mode 100644 vendor/lusitanian/oauth/examples/bitly.php delete mode 100644 vendor/lusitanian/oauth/examples/bitrix24.php delete mode 100644 vendor/lusitanian/oauth/examples/bootstrap.php delete mode 100644 vendor/lusitanian/oauth/examples/box.php delete mode 100644 vendor/lusitanian/oauth/examples/buffer.php delete mode 100644 vendor/lusitanian/oauth/examples/dailymotion.php delete mode 100644 vendor/lusitanian/oauth/examples/deezer.php delete mode 100644 vendor/lusitanian/oauth/examples/delicious.php delete mode 100644 vendor/lusitanian/oauth/examples/deviantart.php delete mode 100644 vendor/lusitanian/oauth/examples/dropbox.php delete mode 100644 vendor/lusitanian/oauth/examples/etsy.php delete mode 100644 vendor/lusitanian/oauth/examples/eveonline.php delete mode 100644 vendor/lusitanian/oauth/examples/facebook.php delete mode 100644 vendor/lusitanian/oauth/examples/fitbit.php delete mode 100644 vendor/lusitanian/oauth/examples/fiveHundredPx.php delete mode 100644 vendor/lusitanian/oauth/examples/flickr.php delete mode 100644 vendor/lusitanian/oauth/examples/foursquare.php delete mode 100644 vendor/lusitanian/oauth/examples/github.php delete mode 100644 vendor/lusitanian/oauth/examples/google.php delete mode 100644 vendor/lusitanian/oauth/examples/harvest.php delete mode 100644 vendor/lusitanian/oauth/examples/hubic.php delete mode 100644 vendor/lusitanian/oauth/examples/init.example.php delete mode 100644 vendor/lusitanian/oauth/examples/instagram.php delete mode 100644 vendor/lusitanian/oauth/examples/jawbone.php delete mode 100644 vendor/lusitanian/oauth/examples/linkedin.php delete mode 100644 vendor/lusitanian/oauth/examples/mailchimp.php delete mode 100644 vendor/lusitanian/oauth/examples/microsoft.php delete mode 100644 vendor/lusitanian/oauth/examples/nest.php delete mode 100644 vendor/lusitanian/oauth/examples/netatmo.php delete mode 100644 vendor/lusitanian/oauth/examples/parrotFlowerPower.php delete mode 100644 vendor/lusitanian/oauth/examples/paypal.php delete mode 100644 vendor/lusitanian/oauth/examples/pinterest.php delete mode 100644 vendor/lusitanian/oauth/examples/pocket.php delete mode 100644 vendor/lusitanian/oauth/examples/quickbooks.php delete mode 100644 vendor/lusitanian/oauth/examples/reddit.php delete mode 100644 vendor/lusitanian/oauth/examples/redmine.php delete mode 100644 vendor/lusitanian/oauth/examples/runkeeper.php delete mode 100644 vendor/lusitanian/oauth/examples/scoopit.php delete mode 100644 vendor/lusitanian/oauth/examples/soundcloud.php delete mode 100644 vendor/lusitanian/oauth/examples/spotify.php delete mode 100644 vendor/lusitanian/oauth/examples/strava.php delete mode 100644 vendor/lusitanian/oauth/examples/tumblr.php delete mode 100644 vendor/lusitanian/oauth/examples/twitter.php delete mode 100644 vendor/lusitanian/oauth/examples/ustream.php delete mode 100644 vendor/lusitanian/oauth/examples/vimeo.php delete mode 100644 vendor/lusitanian/oauth/examples/yahoo.php delete mode 100644 vendor/lusitanian/oauth/examples/yammer.php create mode 100644 vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/BattleNet.php create mode 100644 vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Mondo.php delete mode 100644 vendor/lusitanian/oauth/tests/Mocks/Common/FakeProject/NS/SomeClass.php delete mode 100644 vendor/lusitanian/oauth/tests/Mocks/Common/Service/Mock.php delete mode 100644 vendor/lusitanian/oauth/tests/Mocks/OAuth1/Service/Fake.php delete mode 100644 vendor/lusitanian/oauth/tests/Mocks/OAuth1/Service/Mock.php delete mode 100644 vendor/lusitanian/oauth/tests/Mocks/OAuth2/Service/Fake.php delete mode 100644 vendor/lusitanian/oauth/tests/Mocks/OAuth2/Service/Mock.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/AutoloaderTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/Consumer/CredentialsTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/Http/Client/AbstractClientTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/Http/Client/CurlClientTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/Http/Client/StreamClientTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/Http/HttpClientsTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/Http/Uri/UriFactoryTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/Http/Uri/UriTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/Service/AbstractServiceTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/Storage/MemoryTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/Storage/RedisTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/Storage/SessionTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/Storage/StorageTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/Storage/SymfonySessionTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/Common/Token/AbstractTokenTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/AbstractServiceTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/BitBucketTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/EtsyTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/FitBitTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/FiveHundredPx.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/FlickrTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/QuickBooksTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/ScoopItTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/TumblrTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/TwitterTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/XingTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/YahooTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth1/Signature/SignatureTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth1/Token/StdOAuth1TokenTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/AbstractServiceTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/AmazonTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/BitlyTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/Bitrix24.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/BoxTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/BufferTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DailymotionTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DeezerTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DeliciousTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DeviantArtTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DropboxTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/EveOnlineTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/FacebookTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/FoursquareTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/GitHubTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/GoogleTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/HerokuTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/HubicTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/InstagramTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/JawboneUPTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/LinkedinTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/MailchimpTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/MicrosoftTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/NestTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/NetatmoTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/ParrotFlowerPowerTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/PaypalTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/PinterestTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/RedditTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/RunKeeperTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/SoundCloudTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/SpotifyTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/StravaTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/UstreamTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/VimeoTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/VkontakteTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/YahooTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/YammerTest.php delete mode 100644 vendor/lusitanian/oauth/tests/Unit/ServiceFactoryTest.php delete mode 100644 vendor/lusitanian/oauth/tests/bootstrap.php diff --git a/composer.lock b/composer.lock index a2454a3..2958214 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "lusitanian/oauth", - "version": "v0.8.9", + "version": "v0.8.10", "source": { "type": "git", "url": "https://github.com/Lusitanian/PHPoAuthLib.git", - "reference": "29bda6e176df6c292a9b1c43ae8a44d56a87c30b" + "reference": "09f4af38f17db6938253f4d1b171d537913ac1ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/29bda6e176df6c292a9b1c43ae8a44d56a87c30b", - "reference": "29bda6e176df6c292a9b1c43ae8a44d56a87c30b", + "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/09f4af38f17db6938253f4d1b171d537913ac1ed", + "reference": "09f4af38f17db6938253f4d1b171d537913ac1ed", "shasum": "" }, "require": { @@ -71,7 +71,7 @@ "oauth", "security" ], - "time": "2016-02-24T00:20:18+00:00" + "time": "2016-07-12T22:15:40+00:00" } ], "packages-dev": [], diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index 4626994..2c72175 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -374,9 +374,13 @@ private function findFileWithExtension($class, $ext) $first = $class[0]; if (isset($this->prefixLengthsPsr4[$first])) { - foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { - if (0 === strpos($class, $prefix)) { - foreach ($this->prefixDirsPsr4[$prefix] as $dir) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath.'\\'; + if (isset($this->prefixDirsPsr4[$search])) { + foreach ($this->prefixDirsPsr4[$search] as $dir) { + $length = $this->prefixLengthsPsr4[$first][$search]; if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { return $file; } diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE index 1a28124..f27399a 100644 --- a/vendor/composer/LICENSE +++ b/vendor/composer/LICENSE @@ -1,5 +1,5 @@ -Copyright (c) 2016 Nils Adermann, Jordi Boggiano +Copyright (c) Nils Adermann, Jordi Boggiano Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 6ced173..d1fe22b 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,17 +1,17 @@ [ { "name": "lusitanian/oauth", - "version": "v0.8.9", - "version_normalized": "0.8.9.0", + "version": "v0.8.10", + "version_normalized": "0.8.10.0", "source": { "type": "git", "url": "https://github.com/Lusitanian/PHPoAuthLib.git", - "reference": "29bda6e176df6c292a9b1c43ae8a44d56a87c30b" + "reference": "09f4af38f17db6938253f4d1b171d537913ac1ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/29bda6e176df6c292a9b1c43ae8a44d56a87c30b", - "reference": "29bda6e176df6c292a9b1c43ae8a44d56a87c30b", + "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/09f4af38f17db6938253f4d1b171d537913ac1ed", + "reference": "09f4af38f17db6938253f4d1b171d537913ac1ed", "shasum": "" }, "require": { @@ -28,7 +28,7 @@ "predis/predis": "Allows using the Redis storage backend.", "symfony/http-foundation": "Allows using the Symfony Session storage backend." }, - "time": "2016-02-24T00:20:18+00:00", + "time": "2016-07-12T22:15:40+00:00", "type": "library", "extra": { "branch-alias": { diff --git a/vendor/lusitanian/oauth/.gitignore b/vendor/lusitanian/oauth/.gitignore deleted file mode 100644 index 54a7fcf..0000000 --- a/vendor/lusitanian/oauth/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.idea -vendor -.DS_Store -examples/init.php -atlassian-ide-plugin.xml -nbproject/ diff --git a/vendor/lusitanian/oauth/.scrutinizer.yml b/vendor/lusitanian/oauth/.scrutinizer.yml deleted file mode 100644 index 5a274c9..0000000 --- a/vendor/lusitanian/oauth/.scrutinizer.yml +++ /dev/null @@ -1,37 +0,0 @@ -before_commands: - - "composer install --dev --prefer-source" - -tools: - php_code_coverage: - enabled: true - test_command: phpunit -c phpunit.xml.dist - filter: - paths: ["src/*"] - php_code_sniffer: - enabled: true - config: - standard: PSR2 - filter: - paths: ["src/*"] - php_cpd: - enabled: true - excluded_dirs: ["examples", "tests", "vendor"] - php_cs_fixer: - enabled: true - config: - level: all - filter: - paths: ["src/*", "tests/*"] - php_loc: - enabled: true - php_mess_detector: - enabled: true - filter: - paths: ["src/*"] - php_pdepend: - enabled: true - excluded_dirs: ["tests", "examples", "vendor"] - php_analyzer: - filter: - paths: ["src/*", "tests/*"] - sensiolabs_security_checker: true diff --git a/vendor/lusitanian/oauth/.travis.yml b/vendor/lusitanian/oauth/.travis.yml deleted file mode 100644 index 36dd61f..0000000 --- a/vendor/lusitanian/oauth/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -sudo: false -language: php - -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - hhvm - -matrix: - allow_failures: - - php: hhvm - -before_script: - - composer self-update - - composer install - - phpenv rehash - -script: - - phpunit --coverage-text diff --git a/vendor/lusitanian/oauth/README.md b/vendor/lusitanian/oauth/README.md index 895558c..2eebab7 100644 --- a/vendor/lusitanian/oauth/README.md +++ b/vendor/lusitanian/oauth/README.md @@ -82,6 +82,7 @@ Included service implementations - LinkedIn - Mailchimp - Microsoft + - Mondo - Nest - Netatmo - Parrot Flower Power @@ -113,6 +114,7 @@ Framework Integration --------------------- * Lithium: Sébastien Charrier has written [an adapter](https://github.com/scharrier/li3_socialauth) for the library. * Laravel 4: Dariusz Prząda has written [a service provider](https://github.com/artdarek/oauth-4-laravel) for the library. +* Laravel 5: Valentin Ivaşcu ported Dariusz Prząda's Laravel 4 library to [Laravel 5](https://github.com/oriceon/oauth-5-laravel). * Symfony: Alexander Pinnecke has written [a Symfony Bundle](https://github.com/apinnecke/OAuthBundle) for the library. Extensions diff --git a/vendor/lusitanian/oauth/examples/amazon.php b/vendor/lusitanian/oauth/examples/amazon.php deleted file mode 100644 index 0798eaf..0000000 --- a/vendor/lusitanian/oauth/examples/amazon.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Amazon; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['amazon']['key'], - $servicesCredentials['amazon']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Amazon service using the credentials, http client, storage mechanism for the token and profile scope -/** @var $amazonService Amazon */ -$amazonService = $serviceFactory->createService('amazon', $credentials, $storage, array('profile')); - -if (!empty($_GET['code'])) { - // This was a callback request from Amazon, get the token - $token = $amazonService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($amazonService->request('/user/profile'), true); - - // Show some of the resultant data - echo 'Your unique Amazon user id is: ' . $result['user_id'] . ' and your name is ' . $result['name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $amazonService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Amazon!"; -} diff --git a/vendor/lusitanian/oauth/examples/bitbucket.php b/vendor/lusitanian/oauth/examples/bitbucket.php deleted file mode 100644 index d933096..0000000 --- a/vendor/lusitanian/oauth/examples/bitbucket.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * Shamelessly cribbed from work by: - * @author David Desberg - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\BitBucket; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// We need to use a persistent storage to save the token, because oauth1 requires the token secret received before' -// the redirect (request token request) in the access token request. -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['bitbucket']['key'], - $servicesCredentials['bitbucket']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the BitBucket service using the credentials, http client and storage mechanism for the token -/** @var $bbService BitBucket */ -$bbService = $serviceFactory->createService('BitBucket', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('BitBucket'); - - // This was a callback request from BitBucket, get the token - $bbService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($bbService->request('user/repositories')); - - echo('The first repo in the list is ' . $result[0]->name); - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $bbService->requestRequestToken(); - - $url = $bbService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with BitBucket!"; -} diff --git a/vendor/lusitanian/oauth/examples/bitly.php b/vendor/lusitanian/oauth/examples/bitly.php deleted file mode 100644 index 9cd27e3..0000000 --- a/vendor/lusitanian/oauth/examples/bitly.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Bitly; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['bitly']['key'], - $servicesCredentials['bitly']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Bitly service using the credentials, http client and storage mechanism for the token -/** @var $bitlyService Bitly */ -$bitlyService = $serviceFactory->createService('bitly', $credentials, $storage); - -if (!empty($_GET['code'])) { - // This was a callback request from bitly, get the token - $bitlyService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($bitlyService->request('user/info'), true); - - // Show some of the resultant data - echo 'Your unique user id is: ' . $result['data']['login'] . ' and your name is ' . $result['data']['display_name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $bitlyService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Bitly!"; -} diff --git a/vendor/lusitanian/oauth/examples/bitrix24.php b/vendor/lusitanian/oauth/examples/bitrix24.php deleted file mode 100644 index 8497490..0000000 --- a/vendor/lusitanian/oauth/examples/bitrix24.php +++ /dev/null @@ -1,56 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\GitHub; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['bitrix24']['key'], - $servicesCredentials['bitrix24']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the GitHub service using the credentials, http client and storage mechanism for the token - -$yourDomain = new \OAuth\Common\Http\Uri\Uri('https://'.$servicesCredentials['bitrix24']['domain']); -/** @var $bitrix24 \OAuth\OAuth2\Service\Bitrix24 */ -$bitrix24 = $serviceFactory->createService('Bitrix24', $credentials, $storage, array('user'), $yourDomain); - -if (!empty($_GET['code'])) { - // This was a callback request from bitrix24, get the token - $bitrix24->requestAccessToken($_GET['code']); - - $response = json_decode($bitrix24->request('user.current'), true); - $userInfo = $response['result']; - - // Show some of the resultant data - echo 'Your email on your bitrix24 account is ' . $userInfo['EMAIL']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $bitrix24->getAuthorizationUri(); - header('Location: ' . $url); - -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Bitrix24!"; -} diff --git a/vendor/lusitanian/oauth/examples/bootstrap.php b/vendor/lusitanian/oauth/examples/bootstrap.php deleted file mode 100644 index f02da41..0000000 --- a/vendor/lusitanian/oauth/examples/bootstrap.php +++ /dev/null @@ -1,29 +0,0 @@ -createFromSuperGlobalArray($_SERVER); -$currentUri->setQuery(''); - -/** - * Load the credential for the different services - */ -require_once __DIR__ . '/init.php'; diff --git a/vendor/lusitanian/oauth/examples/box.php b/vendor/lusitanian/oauth/examples/box.php deleted file mode 100644 index f1b0644..0000000 --- a/vendor/lusitanian/oauth/examples/box.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @author Pieter Hordijk - * @author Antoine Corcy - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Box; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['box']['key'], - $servicesCredentials['box']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Box service using the credentials, http client and storage mechanism for the token -/** @var $boxService Box */ -$boxService = $serviceFactory->createService('box', $credentials, $storage); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - - // This was a callback request from box, get the token - $token = $boxService->requestAccessToken($_GET['code'], $state); - - // Send a request with it - $result = json_decode($boxService->request('/users/me'), true); - - // Show some of the resultant data - echo 'Your Box name is ' . $result['name'] . ' and your email is ' . $result['login']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $boxService->getAuthorizationUri(); - // var_dump($url); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Box!"; -} diff --git a/vendor/lusitanian/oauth/examples/buffer.php b/vendor/lusitanian/oauth/examples/buffer.php deleted file mode 100644 index c1b9ddd..0000000 --- a/vendor/lusitanian/oauth/examples/buffer.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Buffer; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['buffer']['key'], - $servicesCredentials['buffer']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the buffer service using the credentials, http client and storage mechanism for the token -/** @var $bufferService buffer */ -$bufferService = $serviceFactory->createService('buffer', $credentials, $storage); - -if (!empty($_GET['code'])) { - // This was a callback request from buffer, get the token - $bufferService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($bufferService->request('user.json'), true); - - // Show some of the resultant data - echo 'Your unique user id is: ' . $result['id'] . ' and your plan is ' . $result['plan']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $bufferService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with buffer!"; -} diff --git a/vendor/lusitanian/oauth/examples/dailymotion.php b/vendor/lusitanian/oauth/examples/dailymotion.php deleted file mode 100644 index 53f0878..0000000 --- a/vendor/lusitanian/oauth/examples/dailymotion.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Dailymotion; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['dailymotion']['key'], - $servicesCredentials['dailymotion']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Dailymotion service using the credentials, http client, storage mechanism for the token and email scope -/** @var $dailymotionService Dailymotion */ -$dailymotionService = $serviceFactory->createService('dailymotion', $credentials, $storage, array('email')); - -if (!empty($_GET['code'])) { - // This was a callback request from Dailymotion, get the token - $token = $dailymotionService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($dailymotionService->request('/me?fields=email,id'), true); - - // Show some of the resultant data - echo 'Your unique Dailymotion user id is: ' . $result['id'] . ' and your email is ' . $result['email']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $dailymotionService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Dailymotion!"; -} diff --git a/vendor/lusitanian/oauth/examples/deezer.php b/vendor/lusitanian/oauth/examples/deezer.php deleted file mode 100644 index 4e4bf47..0000000 --- a/vendor/lusitanian/oauth/examples/deezer.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link http://developers.deezer.com/api/ - */ - -use OAuth\OAuth2\Service\Deezer; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Http\Client\CurlClient; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['deezer']['key'], - $servicesCredentials['deezer']['secret'], - $currentUri->getAbsoluteUri() // Deezer require Https callback's url -); -$serviceFactory->setHttpClient(new CurlClient); -// Instantiate the Deezer service using the credentials, http client and storage mechanism for the token -/** @var $deezerService Deezer */ -$deezerService = $serviceFactory->createService('deezer', $credentials, $storage, [Deezer::SCOPE_BASIC_ACCESS, Deezer::SCOPE_OFFLINE_ACCESS, Deezer::SCOPE_EMAIL, Deezer::SCOPE_DELETE_LIBRARY]); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - // This was a callback request from deezer, get the token - $token = $deezerService->requestAccessToken($_GET['code'], $state); - // Show some of the resultant data - $result = json_decode($deezerService->request('user/me'), true); - echo 'Hello ' . ucfirst($result['name']) - . ' your Deezer Id is ' . $result['id']; - echo '
'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $deezerService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Deezer!"; -} diff --git a/vendor/lusitanian/oauth/examples/delicious.php b/vendor/lusitanian/oauth/examples/delicious.php deleted file mode 100644 index 1002b51..0000000 --- a/vendor/lusitanian/oauth/examples/delicious.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link https://github.com/SciDevs/delicious-api/blob/master/api/oauth.md - */ - -use OAuth\OAuth2\Service\Delicious; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Http\Client\CurlClient; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['delicious']['key'], - $servicesCredentials['delicious']['secret'], - $currentUri->getAbsoluteUri() -); -// Use Curl HTTP Client -$serviceFactory->setHttpClient(new CurlClient); - -// Instantiate the Delicious service using the credentials, http client and storage mechanism for the token -$deliciousService = $serviceFactory->createService('delicious', $credentials, $storage); - -if (!empty($_GET['code'])) { - // This was a callback request from delicious, get the token - $token = $deliciousService->requestAccessToken($_GET['code']); - // Show some of the resultant data - echo 'Your Delicious access_token is : '.$token->getAccessToken()."\n"; - // Fetch recent post - $xml = simplexml_load_string($deliciousService->request('/posts/recent')); - $json = json_encode($xml); - $array = json_decode($json, true); - echo "Your recents posts saved are : \n"; - foreach ($array['post'] as $key => $value) { - echo $value['@attributes']['description'].' ('.$value['@attributes']['href'].')'."\n"; - } - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $deliciousService->getAuthorizationUri(); - // var_dump($url); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Delicious!"; -} diff --git a/vendor/lusitanian/oauth/examples/deviantart.php b/vendor/lusitanian/oauth/examples/deviantart.php deleted file mode 100644 index cb8ea4d..0000000 --- a/vendor/lusitanian/oauth/examples/deviantart.php +++ /dev/null @@ -1,54 +0,0 @@ - - * @author David Desberg - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Facebook; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['deviantart']['key'], - $servicesCredentials['deviantart']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the DeviantArt service using the credentials, http client and storage mechanism for the token -/** @var $deviantArtService DeviantArt */ -$deviantArtService = $serviceFactory->createService('DeviantArt', $credentials, $storage, array('browse')); - -if (!empty($_GET['code'])) { - // This was a callback request from facebook, get the token - $token = $deviantArtService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($deviantArtService->request('/user/whoami'), true); - - // Show some of the resultant data - echo 'Your DeviantArt username is: ' . $result['username']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $deviantArtService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with DeviantArt!"; -} diff --git a/vendor/lusitanian/oauth/examples/dropbox.php b/vendor/lusitanian/oauth/examples/dropbox.php deleted file mode 100644 index 0d60551..0000000 --- a/vendor/lusitanian/oauth/examples/dropbox.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Dropbox; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['dropbox']['key'], - $servicesCredentials['dropbox']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Dropbox service using the credentials, http client and storage mechanism for the token -/** @var $dropboxService Dropbox */ -$dropboxService = $serviceFactory->createService('dropbox', $credentials, $storage, array()); - -if (!empty($_GET['code'])) { - // This was a callback request from Dropbox, get the token - $token = $dropboxService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($dropboxService->request('/account/info'), true); - - // Show some of the resultant data - echo 'Your unique Dropbox user id is: ' . $result['uid'] . ' and your name is ' . $result['display_name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $dropboxService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Dropbox!"; -} diff --git a/vendor/lusitanian/oauth/examples/etsy.php b/vendor/lusitanian/oauth/examples/etsy.php deleted file mode 100644 index 0c0b79b..0000000 --- a/vendor/lusitanian/oauth/examples/etsy.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @copyright Copyright (c) 2013 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\Etsy; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['etsy']['key'], - $servicesCredentials['etsy']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Etsy service using the credentials, http client and storage mechanism for the token -/** @var $etsyService Etsy */ -$etsyService = $serviceFactory->createService('Etsy', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('Etsy'); - - // This was a callback request from Etsy, get the token - $etsyService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($etsyService->request('/private/users/__SELF__')); - - echo 'result:
' . print_r($result, true) . '
'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $response = $etsyService->requestRequestToken(); - $extra = $response->getExtraParams(); - $url = $extra['login_url']; - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Etsy!"; -} diff --git a/vendor/lusitanian/oauth/examples/eveonline.php b/vendor/lusitanian/oauth/examples/eveonline.php deleted file mode 100644 index 892c62e..0000000 --- a/vendor/lusitanian/oauth/examples/eveonline.php +++ /dev/null @@ -1,55 +0,0 @@ - - * @copyright Copyright (c) 2014 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Storage\Session; -use OAuth\OAuth2\Service\EveOnline; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['eveonline']['key'], - $servicesCredentials['eveonline']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Eve Online service using the credentials, http client, storage mechanism for the token and profile scope -/** @var EveOnline $eveService */ -$eveService = $serviceFactory->createService('EveOnline', $credentials, $storage, array('')); - -if (!empty($_GET['code'])) { - // This was a callback request from Eve Online, get the token - $token = $eveService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($eveService->request('/oauth/verify'), true); - - // Show some of the resultant data - print 'CharacterName: ' . $result['CharacterName'] . PHP_EOL - . 'CharacterID: ' . $result['CharacterID'] . PHP_EOL - . 'ExpiresOn: ' . $result['ExpiresOn'] . PHP_EOL - . 'Scopes: ' . $result['Scopes'] . PHP_EOL - . 'TokenType: ' . $result['TokenType'] . PHP_EOL - . 'CharacterOwnerHash: ' . $result['CharacterOwnerHash'] . PHP_EOL; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $eveService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - print "Login with Eve Online!"; -} diff --git a/vendor/lusitanian/oauth/examples/facebook.php b/vendor/lusitanian/oauth/examples/facebook.php deleted file mode 100644 index 6dce36b..0000000 --- a/vendor/lusitanian/oauth/examples/facebook.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @author David Desberg - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Facebook; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['facebook']['key'], - $servicesCredentials['facebook']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Facebook service using the credentials, http client and storage mechanism for the token -/** @var $facebookService Facebook */ -$facebookService = $serviceFactory->createService('facebook', $credentials, $storage, array()); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - - // This was a callback request from facebook, get the token - $token = $facebookService->requestAccessToken($_GET['code'], $state); - - // Send a request with it - $result = json_decode($facebookService->request('/me'), true); - - // Show some of the resultant data - echo 'Your unique facebook user id is: ' . $result['id'] . ' and your name is ' . $result['name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $facebookService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Facebook!"; -} diff --git a/vendor/lusitanian/oauth/examples/fitbit.php b/vendor/lusitanian/oauth/examples/fitbit.php deleted file mode 100644 index 35b3d09..0000000 --- a/vendor/lusitanian/oauth/examples/fitbit.php +++ /dev/null @@ -1,61 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\FitBit; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['fitbit']['key'], - $servicesCredentials['fitbit']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the FitBit service using the credentials, http client and storage mechanism for the token -/** @var $fitbitService FitBit */ -$fitbitService = $serviceFactory->createService('FitBit', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('FitBit'); - - // This was a callback request from fitbit, get the token - $fitbitService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($fitbitService->request('user/-/profile.json')); - - echo 'result:
' . print_r($result, true) . '
'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $fitbitService->requestRequestToken(); - - $url = $fitbitService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with FitBit!"; -} diff --git a/vendor/lusitanian/oauth/examples/fiveHundredPx.php b/vendor/lusitanian/oauth/examples/fiveHundredPx.php deleted file mode 100644 index 9618421..0000000 --- a/vendor/lusitanian/oauth/examples/fiveHundredPx.php +++ /dev/null @@ -1,61 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link https://developers.500px.com/ - */ - -use OAuth\OAuth1\Service\fiveHundredPx; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['fivehundredpx']['key'], - $servicesCredentials['fivehundredpx']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the fiveHundredPx service using the credentials, http client and storage mechanism for the token -/** @var $fivehundredpxService fiveHundredPx */ -$fivehundredpxService = $serviceFactory->createService('FiveHundredPx', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('FiveHundredPx'); - - // This was a callback request from fivehundredpx, get the token - $fivehundredpxService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - // Send a request now that we have access token - $result = json_decode($fivehundredpxService->request('https://api.500px.com/v1/users'), true); - - echo '
'.$result['user']['username'].'
'; - echo 'result:
' . print_r($result, true) . '
'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $fivehundredpxService->requestRequestToken(); - - $url = $fivehundredpxService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with fiveHundredPx!"; -} diff --git a/vendor/lusitanian/oauth/examples/flickr.php b/vendor/lusitanian/oauth/examples/flickr.php deleted file mode 100644 index f7a80f6..0000000 --- a/vendor/lusitanian/oauth/examples/flickr.php +++ /dev/null @@ -1,80 +0,0 @@ - - * @copyright Copyright (c) 2013 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\Flickr; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Http\Client\CurlClient; - -/** - * Bootstrap the example - */ -require_once __DIR__.'/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['flickr']['key'], - $servicesCredentials['flickr']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Flickr service using the credentials, http client and storage mechanism for the token -$flickrService = $serviceFactory->createService('Flickr', $credentials, $storage); - -$step = isset($_GET['step']) ? (int)$_GET['step'] : null; - -$oauth_token = isset($_GET['oauth_token']) ? $_GET['oauth_token'] : null; -$oauth_verifier = isset($_GET['oauth_verifier']) ? $_GET['oauth_verifier'] : null; - -if($oauth_token && $oauth_verifier){ - $step = 2; -} - -switch($step){ - default: - print "Login with Flickr!"; - break; - - case 1: - - if($token = $flickrService->requestRequestToken()){ - $oauth_token = $token->getAccessToken(); - $secret = $token->getAccessTokenSecret(); - - if($oauth_token && $secret){ - $url = $flickrService->getAuthorizationUri(array('oauth_token' => $oauth_token, 'perms' => 'write')); - header('Location: '.$url); - } - } - - break; - - case 2: - $token = $storage->retrieveAccessToken('Flickr'); - $secret = $token->getAccessTokenSecret(); - - if($token = $flickrService->requestAccessToken($oauth_token, $oauth_verifier, $secret)){ - $oauth_token = $token->getAccessToken(); - $secret = $token->getAccessTokenSecret(); - - $storage->storeAccessToken('Flickr', $token); - - header('Location: '.$currentUri->getAbsoluteUri().'?step=3'); - } - break; - - case 3: - $xml = simplexml_load_string($flickrService->request('flickr.test.login')); - print "status: ".(string)$xml->attributes()->stat."\n"; - break; -} diff --git a/vendor/lusitanian/oauth/examples/foursquare.php b/vendor/lusitanian/oauth/examples/foursquare.php deleted file mode 100644 index f792072..0000000 --- a/vendor/lusitanian/oauth/examples/foursquare.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Foursquare; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['foursquare']['key'], - $servicesCredentials['foursquare']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Foursquare service using the credentials, http client and storage mechanism for the token -/** @var $foursquareService Foursquare */ -$foursquareService = $serviceFactory->createService('foursquare', $credentials, $storage); - -if (!empty($_GET['code'])) { - // This was a callback request from foursquare, get the token - $foursquareService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($foursquareService->request('users/self'), true); - - // Show some of the resultant data - echo 'Your unique foursquare user id is: ' . $result['response']['user']['id'] . ' and your name is ' . $result['response']['user']['firstName'] . $result['response']['user']['lastName']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $foursquareService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Foursquare!"; -} diff --git a/vendor/lusitanian/oauth/examples/github.php b/vendor/lusitanian/oauth/examples/github.php deleted file mode 100644 index 23e971f..0000000 --- a/vendor/lusitanian/oauth/examples/github.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\GitHub; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['github']['key'], - $servicesCredentials['github']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the GitHub service using the credentials, http client and storage mechanism for the token -/** @var $gitHub GitHub */ -$gitHub = $serviceFactory->createService('GitHub', $credentials, $storage, array('user')); - -if (!empty($_GET['code'])) { - // This was a callback request from github, get the token - $gitHub->requestAccessToken($_GET['code']); - - $result = json_decode($gitHub->request('user/emails'), true); - - echo 'The first email on your github account is ' . $result[0]; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $gitHub->getAuthorizationUri(); - header('Location: ' . $url); - -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Github!"; -} diff --git a/vendor/lusitanian/oauth/examples/google.php b/vendor/lusitanian/oauth/examples/google.php deleted file mode 100644 index 3bb8473..0000000 --- a/vendor/lusitanian/oauth/examples/google.php +++ /dev/null @@ -1,56 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Google; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['google']['key'], - $servicesCredentials['google']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Google service using the credentials, http client and storage mechanism for the token -/** @var $googleService Google */ -$googleService = $serviceFactory->createService('google', $credentials, $storage, array('userinfo_email', 'userinfo_profile')); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - - // This was a callback request from google, get the token - $googleService->requestAccessToken($_GET['code'], $state); - - // Send a request with it - $result = json_decode($googleService->request('userinfo'), true); - - // Show some of the resultant data - echo 'Your unique google user id is: ' . $result['id'] . ' and your name is ' . $result['name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $googleService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Google!"; -} diff --git a/vendor/lusitanian/oauth/examples/harvest.php b/vendor/lusitanian/oauth/examples/harvest.php deleted file mode 100644 index 1d11584..0000000 --- a/vendor/lusitanian/oauth/examples/harvest.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Storage\Session; -use OAuth\Common\Token\Exception\ExpiredTokenException; -use OAuth\OAuth2\Service\Harvest; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -$serviceName = 'Harvest'; -$scopes = array(); - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['harvest']['key'], - $servicesCredentials['harvest']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Harvest service using the credentials, http client and storage mechanism for the token -/** @var $harves Harves */ -$harvest = $serviceFactory->createService($serviceName, $credentials, $storage, $scopes); - -if (!empty($_GET['clearToken'])) { - // Clear the current AccessToken and go back to the Beginning. - $storage->clearToken($serviceName); - header('Location: ' . $currentUri->getAbsoluteUri()); - -} elseif ($storage->hasAccessToken($serviceName)) { - // fetch the accessToken for the service - $accessToken = $storage->retrieveAccessToken($serviceName); - - // is the accessToken expired? then let's refesh it! - if ($accessToken->isExpired() === TRUE) { - $harvest->refreshAccessToken($accessToken); - } - - // use the service with the valid access token to fetch my email - $result = json_decode($harvest->request('account/who_am_i'), true); - echo 'The email on your harvest account is ' . $result['user']['email']; - - $url = $currentUri->getRelativeUri() . '?clearToken=1'; - echo " Click here to clear the current access token"; - -} elseif (!empty($_GET['code'])) { - // This was a callback request from harvest, get the token - $harvest->requestAccessToken($_GET['code']); - header('Location: ' . $currentUri->getAbsoluteUri()); - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // Redirect to the Authorization uri - $url = $harvest->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Harvest!"; -} diff --git a/vendor/lusitanian/oauth/examples/hubic.php b/vendor/lusitanian/oauth/examples/hubic.php deleted file mode 100644 index dca740d..0000000 --- a/vendor/lusitanian/oauth/examples/hubic.php +++ /dev/null @@ -1,62 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link https://api.hubic.com/docs/ - */ - -use OAuth\OAuth2\Service\Hubic; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Http\Client\CurlClient; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['hubic']['key'], - $servicesCredentials['hubic']['secret'], - $currentUri->getAbsoluteUri() -); - -$scopes = array( - Hubic::SCOPE_USAGE_GET, - Hubic::SCOPE_ACCOUNT_GET, - Hubic::SCOPE_GETALLLINKS_GET, - Hubic::SCOPE_LINKS_ALL, -); - -$serviceFactory->setHttpClient(new CurlClient); - -// Instantiate the Hubic service using the credentials, http client and storage mechanism for the token -/** @var $hubicService Hubic */ -$hubicService = $serviceFactory->createService('hubic', $credentials, $storage, $scopes); - -if (!empty($_GET['code'])) { - // This was a callback request from hubic, get the token - $token = $hubicService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($hubicService->request('https://api.hubic.com/1.0/account'), true); - // Show some of the resultant data - echo 'Hello '.ucfirst($result['firstname']).' '.strtoupper($result['lastname']).' ('.$result['email'].')'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $hubicService->getAuthorizationUri(); - // var_dump($url); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Hubic!"; -} diff --git a/vendor/lusitanian/oauth/examples/init.example.php b/vendor/lusitanian/oauth/examples/init.example.php deleted file mode 100644 index 969c485..0000000 --- a/vendor/lusitanian/oauth/examples/init.example.php +++ /dev/null @@ -1,204 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -/** - * @var array A list of all the credentials to be used by the different services in the examples - */ -$servicesCredentials = array( - 'amazon' => array( - 'key' => '', - 'secret' => '', - ), - 'bitbucket' => array( - 'key' => '', - 'secret' => '', - ), - 'bitly' => array( - 'key' => '', - 'secret' => '', - ), - 'bitrix24' => array( - 'key' => '', - 'secret' => '', - ), - 'box' => array( - 'key' => '', - 'secret' => '', - ), - 'buffer' => array( - 'key' => '', - 'secret' => '', - ), - 'dailymotion' => array( - 'key' => '', - 'secret' => '', - ), - 'delicious' => array( - 'key' => '', - 'secret' => '', - ), - 'deezer' => array( - 'key' => '', - 'secret' => '', - ), - 'deviantart' => array( - 'key' => '', - 'secret' => '', - ), - 'dropbox' => array( - 'key' => '', - 'secret' => '', - ), - 'etsy' => array( - 'key' => '', - 'secret' => '', - ), - 'eveonline' => array( - 'key' => '', - 'secret' => '', - ), - 'facebook' => array( - 'key' => '', - 'secret' => '', - ), - 'fitbit' => array( - 'key' => '', - 'secret' => '', - ), - 'fivehundredpx' => array( - 'key' => '', - 'secret' => '', - ), - 'flickr' => array( - 'key' => '', - 'secret' => '', - ), - 'foursquare' => array( - 'key' => '', - 'secret' => '', - ), - 'github' => array( - 'key' => '', - 'secret' => '', - ), - 'google' => array( - 'key' => '', - 'secret' => '', - ), - 'hubic' => array( - 'key' => '', - 'secret' => '', - ), - 'instagram' => array( - 'key' => '', - 'secret' => '', - ), - 'linkedin' => array( - 'key' => '', - 'secret' => '', - ), - 'mailchimp' => array( - 'key' => '', - 'secret' => '', - ), - 'microsoft' => array( - 'key' => '', - 'secret' => '', - ), - 'nest' => array( - 'key' => '', - 'secret' => '', - ), - 'netatmo' => array( - 'key' => '', - 'secret' => '', - ), - 'parrotFlowerPower' => array( - 'key' => '', - 'secret' => '', - ), - 'paypal' => array( - 'key' => '', - 'secret' => '', - ), - 'pinterest' => array( - 'key' => '', - 'secret' => '', - ), - 'pocket' => array( - 'key' => '', - ), - 'quickbooks' => array( - 'key' => '', - 'secret' => '', - ), - 'reddit' => array( - 'key' => '', - 'secret' => '', - ), - 'redmine' => array( - 'key' => '', - 'secret' => '' - ), - 'runkeeper' => array( - 'key' => '', - 'secret' => '', - ), - 'salesforce' => array( - 'key' => '', - 'secret' => '' - ), - 'scoopit' => array( - 'key' => '', - 'secret' => '' - ), - 'soundcloud' => array( - 'key' => '', - 'secret' => '', - ), - 'spotify' => array( - 'key' => '', - 'secret' => '', - ), - 'strava' => array( - 'key' => '', - 'secret' => '', - ), - 'tumblr' => array( - 'key' => '', - 'secret' => '', - ), - 'twitter' => array( - 'key' => '', - 'secret' => '', - ), - 'ustream' => array( - 'key' => '', - 'secret' => '', - ), - 'vimeo' => array( - 'key' => '', - 'secret' => '', - ), - 'yahoo' => array( - 'key' => '', - 'secret' => '' - ), - 'yammer' => array( - 'key' => '', - 'secret' => '' - ), -); - -/** @var $serviceFactory \OAuth\ServiceFactory An OAuth service factory. */ -$serviceFactory = new \OAuth\ServiceFactory(); diff --git a/vendor/lusitanian/oauth/examples/instagram.php b/vendor/lusitanian/oauth/examples/instagram.php deleted file mode 100644 index 2c96f62..0000000 --- a/vendor/lusitanian/oauth/examples/instagram.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @author Pieter Hordijk - * @author Hannes Van De Vreken - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Instagram; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['instagram']['key'], - $servicesCredentials['instagram']['secret'], - $currentUri->getAbsoluteUri() -); - -$scopes = array('basic', 'comments', 'relationships', 'likes'); - -// Instantiate the Instagram service using the credentials, http client and storage mechanism for the token -/** @var $instagramService Instagram */ -$instagramService = $serviceFactory->createService('instagram', $credentials, $storage, $scopes); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - - // This was a callback request from Instagram, get the token - $instagramService->requestAccessToken($_GET['code'], $state); - - // Send a request with it - $result = json_decode($instagramService->request('users/self'), true); - - // Show some of the resultant data - echo 'Your unique instagram user id is: ' . $result['data']['id'] . ' and your name is ' . $result['data']['full_name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $instagramService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Instagram!"; -} diff --git a/vendor/lusitanian/oauth/examples/jawbone.php b/vendor/lusitanian/oauth/examples/jawbone.php deleted file mode 100644 index 9bcf44c..0000000 --- a/vendor/lusitanian/oauth/examples/jawbone.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\JawboneUP; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['jawbone']['key'], - $servicesCredentials['jawbone']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Jawbone UP service using the credentials, http client and storage mechanism for the token -/** @var $jawboneService JawboneUP */ -$jawboneService = $serviceFactory->createService('JawboneUP', $credentials, $storage, array()); - -if (!empty($_GET['code'])) { - // This was a callback request from JawboneUP, get the token - $token = $jawboneService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($jawboneService->request('/users/@me'), true); - - // Show some of the resultant data - echo 'Your unique Jawbone UP user id is: ' . $result['data']['xid']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $jawboneService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Jawbone UP!"; -} diff --git a/vendor/lusitanian/oauth/examples/linkedin.php b/vendor/lusitanian/oauth/examples/linkedin.php deleted file mode 100644 index db14ab2..0000000 --- a/vendor/lusitanian/oauth/examples/linkedin.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @author Pieter Hordijk - * @author Antoine Corcy - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Linkedin; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['linkedin']['key'], - $servicesCredentials['linkedin']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Linkedin service using the credentials, http client and storage mechanism for the token -/** @var $linkedinService Linkedin */ -$linkedinService = $serviceFactory->createService('linkedin', $credentials, $storage, array('r_basicprofile')); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - - // This was a callback request from linkedin, get the token - $token = $linkedinService->requestAccessToken($_GET['code'], $state); - - // Send a request with it. Please note that XML is the default format. - $result = json_decode($linkedinService->request('/people/~?format=json'), true); - - // Show some of the resultant data - echo 'Your linkedin first name is ' . $result['firstName'] . ' and your last name is ' . $result['lastName']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $linkedinService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Linkedin!"; -} diff --git a/vendor/lusitanian/oauth/examples/mailchimp.php b/vendor/lusitanian/oauth/examples/mailchimp.php deleted file mode 100644 index dd7e12b..0000000 --- a/vendor/lusitanian/oauth/examples/mailchimp.php +++ /dev/null @@ -1,55 +0,0 @@ - - * @author Hannes Van De Vreken - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Mailchimp; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -$_SERVER['SERVER_PORT'] = 80; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['mailchimp']['key'], - $servicesCredentials['mailchimp']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Mailchimp service using the credentials, http client and storage mechanism for the token -/** @var $mailchimpService Mailchimp */ -$mailchimpService = $serviceFactory->createService('mailchimp', $credentials, $storage, array()); - -if (!empty($_GET['code'])) { - // This was a callback request from mailchimp, get the token - $token = $mailchimpService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = $mailchimpService->request('/users/profile.json'); - - header('Content-Type: application/json'); - echo $result; exit; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $mailchimpService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Mailchimp!"; -} diff --git a/vendor/lusitanian/oauth/examples/microsoft.php b/vendor/lusitanian/oauth/examples/microsoft.php deleted file mode 100644 index 1edb13f..0000000 --- a/vendor/lusitanian/oauth/examples/microsoft.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Microsoft; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['microsoft']['key'], - $servicesCredentials['microsoft']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Microsoft service using the credentials, http client and storage mechanism for the token -/** @var $microsoft Microsoft */ -$microsoft = $serviceFactory->createService('microsoft', $credentials, $storage, array('basic')); - -if (!empty($_GET['code'])) { - // This was a callback request from Microsoft, get the token - $token = $microsoft->requestAccessToken($_GET['code']); - - var_dump($token); - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $microsoft->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Microsoft!"; -} diff --git a/vendor/lusitanian/oauth/examples/nest.php b/vendor/lusitanian/oauth/examples/nest.php deleted file mode 100644 index cb05903..0000000 --- a/vendor/lusitanian/oauth/examples/nest.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link https://developer.nest.com/documentation - */ - -use OAuth\OAuth2\Service\Nest; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Http\Client\CurlClient; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['nest']['key'], - $servicesCredentials['nest']['secret'], - $currentUri->getAbsoluteUri() -); - -$serviceFactory->setHttpClient(new CurlClient); -// Instantiate the Nest service using the credentials, http client and storage mechanism for the token -/** @var $nestService Nest */ -$nestService = $serviceFactory->createService('nest', $credentials, $storage); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - // This was a callback request from nest, get the token - $token = $nestService->requestAccessToken($_GET['code'], $state); - // Show some of the resultant data - $result = json_decode($nestService->request('/devices'), true); - echo 'Your devices informations ' . print_r($result, true); -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $nestService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Nest!"; -} diff --git a/vendor/lusitanian/oauth/examples/netatmo.php b/vendor/lusitanian/oauth/examples/netatmo.php deleted file mode 100644 index 56dc039..0000000 --- a/vendor/lusitanian/oauth/examples/netatmo.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link https://dev.netatmo.com/doc/ - */ - -use OAuth\OAuth2\Service\Netatmo; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Http\Client\CurlClient; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['netatmo']['key'], - $servicesCredentials['netatmo']['secret'], - $currentUri->getAbsoluteUri() -); - -$serviceFactory->setHttpClient(new CurlClient); - -// Instantiate the Netatmo service using the credentials, http client and storage mechanism for the token -$NetatmoService = $serviceFactory->createService('Netatmo', $credentials, $storage); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - // This was a callback request from Netatmo, get the token - $token = $NetatmoService->requestAccessToken($_GET['code'], $state); - // Send a request with it - $result = json_decode($NetatmoService->request('getuser'), true); - // Show some of the resultant data - echo 'Hello '.$result['body']['mail']; -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $NetatmoService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Netatmo!"; -} diff --git a/vendor/lusitanian/oauth/examples/parrotFlowerPower.php b/vendor/lusitanian/oauth/examples/parrotFlowerPower.php deleted file mode 100644 index d58c347..0000000 --- a/vendor/lusitanian/oauth/examples/parrotFlowerPower.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link https://flowerpowerdev.parrot.com/projects/flower-power-web-service-api/wiki - */ - -use OAuth\OAuth2\Service\ParrotFlowerPower; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Http\Client\CurlClient; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['parrotFlowerPower']['key'], - $servicesCredentials['parrotFlowerPower']['secret'], - $currentUri->getAbsoluteUri() -); - -$serviceFactory->setHttpClient(new CurlClient); - -// Instantiate the ParrotFlowerPower service using the credentials, http client and storage mechanism for the token -$parrotFlowerPowerService = $serviceFactory->createService('parrotFlowerPower', $credentials, $storage); - -if (!empty($_GET['code'])) { - // This was a callback request from parrotFlowerPower, get the token - $token = $parrotFlowerPowerService->requestAccessToken($_GET['code']); - // Send a request with it - $result = json_decode($parrotFlowerPowerService->request('https://apiflowerpower.parrot.com/user/v4/profile'), true); - // Show some of the resultant data - echo 'Hello '.$result['user_profile']['username'].' '.$result['user_profile']['email']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $parrotFlowerPowerService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with ParrotFlowerPower!"; -} diff --git a/vendor/lusitanian/oauth/examples/paypal.php b/vendor/lusitanian/oauth/examples/paypal.php deleted file mode 100644 index 207357f..0000000 --- a/vendor/lusitanian/oauth/examples/paypal.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Paypal; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['paypal']['key'], - $servicesCredentials['paypal']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the PayPal service using the credentials, http client, storage mechanism for the token and profile/openid scopes -/** @var $paypalService PayPal */ -$paypalService = $serviceFactory->createService('paypal', $credentials, $storage, array('profile', 'openid')); - -if (!empty($_GET['code'])) { - // This was a callback request from PayPal, get the token - $token = $paypalService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($paypalService->request('/identity/openidconnect/userinfo/?schema=openid'), true); - - // Show some of the resultant data - echo 'Your unique PayPal user id is: ' . $result['user_id'] . ' and your name is ' . $result['name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $paypalService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with PayPal!"; -} diff --git a/vendor/lusitanian/oauth/examples/pinterest.php b/vendor/lusitanian/oauth/examples/pinterest.php deleted file mode 100644 index c810cbd..0000000 --- a/vendor/lusitanian/oauth/examples/pinterest.php +++ /dev/null @@ -1,51 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link https://developers.pinterest.com/docs/api/overview/ - */ - -use OAuth\OAuth2\Service\Pinterest; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Http\Client\CurlClient; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['pinterest']['key'], - $servicesCredentials['pinterest']['secret'], - preg_replace('$http://$', 'https://', $currentUri->getAbsoluteUri()) // Pinterest require Https callback's url -); -$serviceFactory->setHttpClient(new CurlClient); -// Instantiate the Pinterest service using the credentials, http client and storage mechanism for the token -/** @var $pinterestService Pinterest */ -$pinterestService = $serviceFactory->createService('pinterest', $credentials, $storage, [Pinterest::SCOPE_READ_PUBLIC]); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - // This was a callback request from pinterest, get the token - $token = $pinterestService->requestAccessToken($_GET['code'], $state); - // Show some of the resultant data - $result = json_decode($pinterestService->request('v1/me/'), true); - echo 'Hello ' . ucfirst($result['data']['first_name']) - . ' ' . strtoupper($result['data']['last_name']) - . ' your Pinterst Id is ' . $result['data']['id']; -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $pinterestService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Pinterest!"; -} diff --git a/vendor/lusitanian/oauth/examples/pocket.php b/vendor/lusitanian/oauth/examples/pocket.php deleted file mode 100644 index b96d2ac..0000000 --- a/vendor/lusitanian/oauth/examples/pocket.php +++ /dev/null @@ -1,63 +0,0 @@ - - * @copyright Copyright (c) 2014 Christian Mayer - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Pocket; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Http\Client\CurlClient; - -/** - * Bootstrap the example - */ -require_once __DIR__.'/bootstrap.php'; - -$step = isset($_GET['step']) ? (int)$_GET['step'] : null; -$code = isset($_GET['code']) ? $_GET['code'] : null; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['pocket']['key'], - null, // Pocket API doesn't have a secret key. :S - $currentUri->getAbsoluteUri().($code ? '?step=3&code='.$code : '') -); - -// Instantiate the Pocket service using the credentials, http client and storage mechanism for the token -$pocketService = $serviceFactory->createService('Pocket', $credentials, $storage); - -switch($step){ - default: - print 'Login with Pocket'; - - break; - - case 1: - $code = $pocketService->requestRequestToken(); - header('Location: '.$currentUri->getRelativeUri().'?step=2&code='.$code); - - break; - - case 2: - $url = $pocketService->getAuthorizationUri(array('request_token' => $code)); - header('Location: '.$url); - - break; - - case 3: - $token = $pocketService->requestAccessToken($code); - $accessToken = $token->getAccessToken(); - $extraParams = $token->getExtraParams(); - - print 'User: '.$extraParams['username'].'
'; - print 'Access Token: '.$accessToken; - break; -} diff --git a/vendor/lusitanian/oauth/examples/quickbooks.php b/vendor/lusitanian/oauth/examples/quickbooks.php deleted file mode 100644 index c54db73..0000000 --- a/vendor/lusitanian/oauth/examples/quickbooks.php +++ /dev/null @@ -1,67 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\QuickBooks; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['quickbooks']['key'], - $servicesCredentials['quickbooks']['secret'], - $currentUri->getAbsoluteUri() -); - -// So we don't have to repeat ourselves. -$serviceName = 'QuickBooks'; - -// Instantiate the Quickbooks service using the credentials, http client and -// storage mechanism for the token -/** @var $quickbooksService QuickBooks */ -$quickbooksService = $serviceFactory->createService( - $serviceName, $credentials, $storage -); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken($serviceName); - - // This was a callback request from QuickBooks, get the token - $quickbooksService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $companyId = $_GET['realmId']; - $url = "/v3/company/$companyId/account/1"; - $result = json_decode($quickbooksService->request($url)); - - echo 'result:
' . print_r($result, true) . '
'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $quickbooksService->requestRequestToken(); - - $url = $quickbooksService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with QuickBooks!"; -} diff --git a/vendor/lusitanian/oauth/examples/reddit.php b/vendor/lusitanian/oauth/examples/reddit.php deleted file mode 100644 index 7363d84..0000000 --- a/vendor/lusitanian/oauth/examples/reddit.php +++ /dev/null @@ -1,54 +0,0 @@ - - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Reddit; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['reddit']['key'], - $servicesCredentials['reddit']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Reddit service using the credentials, http client and storage mechanism for the token -/** @var $reddit Reddit */ -$reddit = $serviceFactory->createService('Reddit', $credentials, $storage, array('identity')); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - - // This was a callback request from reddit, get the token - $reddit->requestAccessToken($_GET['code'], $state); - - $result = json_decode($reddit->request('api/v1/me.json'), true); - - echo 'Your unique reddit user id is: ' . $result['id'] . ' and your username is ' . $result['name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $reddit->getAuthorizationUri(); - header('Location: ' . $url); - -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Reddit!"; -} diff --git a/vendor/lusitanian/oauth/examples/redmine.php b/vendor/lusitanian/oauth/examples/redmine.php deleted file mode 100644 index bce145a..0000000 --- a/vendor/lusitanian/oauth/examples/redmine.php +++ /dev/null @@ -1,62 +0,0 @@ - - * @copyright Copyright (c) 2015 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * - * Example based on the yahoo example - */ - -/** - * Bootstrap the example - */ -require_once __DIR__.'/bootstrap.php'; - -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; -use OAuth\Common\Http\Uri\Uri; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['redmine']['key'], - $servicesCredentials['redmine']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Redmine service using the credentials, http client, storage mechanism for the token and adding the base uri of the oauth provider -$redmineService = $serviceFactory->createService('Redmine', $credentials, $storage, array(), new Uri('https://redmine.example.dev/oauth/')); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('Redmine'); - - // This was a callback request from Redmine, get the token - $redmineService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($redmineService->request('user_info.json')); - - echo 'result:
' . print_r($result, true) . '
'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $redmineService->requestRequestToken(); - - $url = $redmineService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = 'http://example.dev/' . '?go=go'; - echo "Login with Redmine!"; -} \ No newline at end of file diff --git a/vendor/lusitanian/oauth/examples/runkeeper.php b/vendor/lusitanian/oauth/examples/runkeeper.php deleted file mode 100644 index 61a203f..0000000 --- a/vendor/lusitanian/oauth/examples/runkeeper.php +++ /dev/null @@ -1,51 +0,0 @@ -getAbsoluteUri() -); - -// Instantiate the Runkeeper service using the credentials, http client and storage mechanism for the token -/** @var $runkeeperService RunKeeper */ -$runkeeperService = $serviceFactory->createService('RunKeeper', $credentials, $storage, array()); - -if (!empty($_GET['code'])) { - // This was a callback request from RunKeeper, get the token - $token = $runkeeperService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($runkeeperService->request('/user'), true); - - // Show some of the resultant data - echo 'Your unique RunKeeper user id is: ' . $result['userID']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $runkeeperService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with RunKeeper!"; -} diff --git a/vendor/lusitanian/oauth/examples/scoopit.php b/vendor/lusitanian/oauth/examples/scoopit.php deleted file mode 100644 index cc1c103..0000000 --- a/vendor/lusitanian/oauth/examples/scoopit.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @copyright Copyright (c) 2013 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\ScoopIt; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__.'/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['scoopit']['key'], - $servicesCredentials['scoopit']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the ScoopIt service using the credentials, http client and storage mechanism for the token -$scoopItService = $serviceFactory->createService('ScoopIt', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('ScoopIt'); - - // This was a callback request from ScoopIt, get the token - $scoopItService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($scoopItService->request('profile')); - - echo 'result:
' . print_r($result, true) . '
'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $scoopItService->requestRequestToken(); - - $url = $scoopItService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with ScoopIt!"; -} diff --git a/vendor/lusitanian/oauth/examples/soundcloud.php b/vendor/lusitanian/oauth/examples/soundcloud.php deleted file mode 100644 index 2629490..0000000 --- a/vendor/lusitanian/oauth/examples/soundcloud.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\SoundCloud; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['soundcloud']['key'], - $servicesCredentials['soundcloud']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the SoundCloud service using the credentials, http client and storage mechanism for the token -/** @var $soundcloudService SoundCloud */ -$soundcloudService = $serviceFactory->createService('soundCloud', $credentials, $storage); - -if (!empty($_GET['code'])) { - // This was a callback request from SoundCloud, get the token - $soundcloudService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($soundcloudService->request('me.json'), true); - - // Show some of the resultant data - echo 'Your unique user id is: ' . $result['id'] . ' and your name is ' . $result['username']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $soundcloudService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with SoundCloud!"; -} diff --git a/vendor/lusitanian/oauth/examples/spotify.php b/vendor/lusitanian/oauth/examples/spotify.php deleted file mode 100644 index 69bd265..0000000 --- a/vendor/lusitanian/oauth/examples/spotify.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @author Ben King - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Spotify; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['spotify']['key'], - $servicesCredentials['spotify']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Spotify service using the credentials, http client and storage mechanism for the token -/** @var $spotifyService Spotify */ -$spotifyService = $serviceFactory->createService('spotify', $credentials, $storage); - -if (!empty($_GET['code'])) { - // This was a callback request from Spotify, get the token - $spotifyService->requestAccessToken($_GET['code']); - - // Send a request with it - $result = json_decode($spotifyService->request('me'), true); - - // Show some of the resultant data - echo 'Your unique user id is: ' . $result['id'] . ' and your name is ' . $result['display_name']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $spotifyService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Spotify!"; -} diff --git a/vendor/lusitanian/oauth/examples/strava.php b/vendor/lusitanian/oauth/examples/strava.php deleted file mode 100644 index 34c76d5..0000000 --- a/vendor/lusitanian/oauth/examples/strava.php +++ /dev/null @@ -1,61 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Strava; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -use OAuth\Common\Http\Client\CurlClient; -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['strava']['key'], - $servicesCredentials['strava']['secret'], - $currentUri->getAbsoluteUri() -); -$scopes = array( - // Strava::SCOPE_WRITE, - // Strava::SCOPE_VIEW_PRIVATE, -); -$serviceFactory->setHttpClient(new CurlClient()); - -// Instantiate the Strava service using the credentials, http client and storage mechanism for the token -/** @var $stravaService Strava */ -$stravaService = $serviceFactory->createService('strava', $credentials, $storage, $scopes); - -// Force approuval -$stravaService->setApprouvalPrompt('force'); - -if (!empty($_GET['code'])) { - // This was a callback request from strava, get the token - $token = $stravaService->requestAccessToken($_GET['code']); - // Send a request with it - $result = json_decode($stravaService->request('/athlete'), true); - - // Show some of the resultant data - echo 'Your Strava user id is: ' . $result['id'] . ' and your name is ' . $result['firstname'] . ' ' . $result['lastname'] . '!'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $stravaService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Strava!"; -} diff --git a/vendor/lusitanian/oauth/examples/tumblr.php b/vendor/lusitanian/oauth/examples/tumblr.php deleted file mode 100644 index bde0521..0000000 --- a/vendor/lusitanian/oauth/examples/tumblr.php +++ /dev/null @@ -1,62 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\Tumblr; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// We need to use a persistent storage to save the token, because oauth1 requires the token secret received before' -// the redirect (request token request) in the access token request. -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['tumblr']['key'], - $servicesCredentials['tumblr']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the tumblr service using the credentials, http client and storage mechanism for the token -/** @var $tumblrService Tumblr */ -$tumblrService = $serviceFactory->createService('tumblr', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('Tumblr'); - - // This was a callback request from tumblr, get the token - $tumblrService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($tumblrService->request('user/info')); - - echo 'result:
' . print_r($result, true) . '
'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $tumblrService->requestRequestToken(); - - $url = $tumblrService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Tumblr!"; -} diff --git a/vendor/lusitanian/oauth/examples/twitter.php b/vendor/lusitanian/oauth/examples/twitter.php deleted file mode 100644 index 6b14a22..0000000 --- a/vendor/lusitanian/oauth/examples/twitter.php +++ /dev/null @@ -1,62 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\Twitter; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// We need to use a persistent storage to save the token, because oauth1 requires the token secret received before' -// the redirect (request token request) in the access token request. -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['twitter']['key'], - $servicesCredentials['twitter']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the twitter service using the credentials, http client and storage mechanism for the token -/** @var $twitterService Twitter */ -$twitterService = $serviceFactory->createService('twitter', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('Twitter'); - - // This was a callback request from twitter, get the token - $twitterService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($twitterService->request('account/verify_credentials.json')); - - echo 'result:
' . print_r($result, true) . '
'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $twitterService->requestRequestToken(); - - $url = $twitterService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Twitter!"; -} diff --git a/vendor/lusitanian/oauth/examples/ustream.php b/vendor/lusitanian/oauth/examples/ustream.php deleted file mode 100644 index e3ca0bb..0000000 --- a/vendor/lusitanian/oauth/examples/ustream.php +++ /dev/null @@ -1,54 +0,0 @@ - - * @copyright Copyright (c) 2014 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Ustream; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['ustream']['key'], - $servicesCredentials['ustream']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Ustream service using the credentials, http client and storage mechanism for the token -/** @var $ustream Ustream */ -$ustream = $serviceFactory->createService('Ustream', $credentials, $storage, array('identity')); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - - // This was a callback request from Ustream, get the token - $ustream->requestAccessToken($_GET['code'], $state); - - $result = json_decode($ustream->request('users/self.json'), true); - - echo 'Your unique Ustream user id is: ' . $result['id'] . ' and your username is ' . $result['username']; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $ustream->getAuthorizationUri(); - header('Location: ' . $url); - -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Ustream!"; -} diff --git a/vendor/lusitanian/oauth/examples/vimeo.php b/vendor/lusitanian/oauth/examples/vimeo.php deleted file mode 100644 index bbe5e72..0000000 --- a/vendor/lusitanian/oauth/examples/vimeo.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @link https://developer.vimeo.com/api/authentication - */ - -use OAuth\OAuth2\Service\Vimeo; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__ . '/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['vimeo']['key'], - $servicesCredentials['vimeo']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the vimeo service using the credentials, http client and storage mechanism for the token -/** @var $vimeoService vimeo */ -$vimeoService = $serviceFactory->createService('Vimeo', $credentials, $storage, [Vimeo::SCOPE_PUBLIC, Vimeo::SCOPE_PRIVATE]); - -if (!empty($_GET['code'])) { - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - // This was a callback request from vimeo, get the token - $token = $vimeoService->requestAccessToken($_GET['code'], $state); - // Send a request now that we have access token - $result = json_decode($vimeoService->request('/me')); - // Show some of the resultant data - echo 'Your unique Vimeo account is '.$result->uri.' and your name is '.$result->name; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $vimeoService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with vimeo!"; -} diff --git a/vendor/lusitanian/oauth/examples/yahoo.php b/vendor/lusitanian/oauth/examples/yahoo.php deleted file mode 100644 index 549332e..0000000 --- a/vendor/lusitanian/oauth/examples/yahoo.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @copyright Copyright (c) 2014 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth1\Service\Yahoo; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -/** - * Bootstrap the example - */ -require_once __DIR__.'/bootstrap.php'; - -// Session storage -$storage = new Session(); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['yahoo']['key'], - $servicesCredentials['yahoo']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Yahoo service using the credentials, http client and storage mechanism for the token -$yahooService = $serviceFactory->createService('Yahoo', $credentials, $storage); - -if (!empty($_GET['oauth_token'])) { - $token = $storage->retrieveAccessToken('Yahoo'); - - // This was a callback request from Yahoo, get the token - $yahooService->requestAccessToken( - $_GET['oauth_token'], - $_GET['oauth_verifier'], - $token->getRequestTokenSecret() - ); - - // Send a request now that we have access token - $result = json_decode($yahooService->request('profile')); - - echo 'result:
' . print_r($result, true) . '
'; - -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - // extra request needed for oauth1 to request a request token :-) - $token = $yahooService->requestRequestToken(); - - $url = $yahooService->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Yahoo!"; -} diff --git a/vendor/lusitanian/oauth/examples/yammer.php b/vendor/lusitanian/oauth/examples/yammer.php deleted file mode 100644 index f5f6e9c..0000000 --- a/vendor/lusitanian/oauth/examples/yammer.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @copyright Copyright (c) 2014 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -use OAuth\OAuth2\Service\Yammer; -use OAuth\Common\Storage\Session; -use OAuth\Common\Consumer\Credentials; - -include_once(__DIR__.'/OAuth/bootstrap.php'); - -$storage = new Session(); - -/** - * In case if you don't use bootstrap from example folder uncomment lines below - */ -//$serviceFactory = new \OAuth\ServiceFactory(); -/* Create a new instance of the URI class with the current URI, stripping the query string - */ -//$uriFactory = new \OAuth\Common\Http\Uri\UriFactory(); -//$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER); -//$currentUri->setQuery(''); - -// Setup the credentials for the requests -$credentials = new Credentials( - $servicesCredentials['yammer']['key'], - $servicesCredentials['yammer']['secret'], - $currentUri->getAbsoluteUri() -); - -// Instantiate the Yammer service using the credentials, http client and storage mechanism for the token -$yammerService = $serviceFactory->createService('yammer', $credentials, $storage, array()); - -if (!empty($_GET['code'])) { - // This was a callback request from yammer, get the token - $token = $yammerService->requestAccessToken($_GET['code']); - - // yammer token, save somewhere and use it for all requests to yammer service - echo $token->getAccessToken(); - - // example of showing all public messages for current user - // all endpoints can be find here: https://developer.yammer.com/restapi/#rest-networks - $result = json_decode($yammerService->request('messages.json'), true); - print_r($result); -} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') { - $url = $yammerService->getAuthorizationUri(); - header('Location: ' . $url); -} else { - $url = $currentUri->getRelativeUri() . '?go=go'; - echo "Login with Yammer!"; -} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/BattleNet.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/BattleNet.php new file mode 100644 index 0000000..ec3fdad --- /dev/null +++ b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/BattleNet.php @@ -0,0 +1,116 @@ +baseApiUri = new Uri( self::API_URI_US ); + } + } + + /** ----------------------------------------------------------------------- + * Translates the current base API URI into an OAuth base URI. + * + * @returns string Base URI of oauth services. + */ + private function GetOAuthBaseUri() { + + // i love china + switch( $this->baseApiUri ) { + case self::API_URI_US: return 'https://us.battle.net/oauth/'; + case self::API_URI_EU: return 'https://eu.battle.net/oauth/'; + case self::API_URI_KR: return 'https://kr.battle.net/oauth/'; + case self::API_URI_TW: return 'https://tw.battle.net/oauth/'; + case self::API_URI_CN: return 'https://www.battlenet.com.cn/oauth/'; + case self::API_URI_SEA: return 'https://sea.battle.net/oauth/'; + } + + } + + /** ----------------------------------------------------------------------- + * {@inheritdoc} + */ + public function getAuthorizationEndpoint() { + return new Uri( $this->GetOAuthBaseUri() . 'authorize' ); + } + + /** ----------------------------------------------------------------------- + * {@inheritdoc} + */ + public function getAccessTokenEndpoint() { + return new Uri( $this->GetOAuthBaseUri() . 'token' ); + } + + /** ----------------------------------------------------------------------- + * {@inheritdoc} + */ + protected function getAuthorizationMethod() + { + return static::AUTHORIZATION_METHOD_QUERY_STRING; + } + + /** ----------------------------------------------------------------------- + * {@inheritdoc} + */ + protected function parseAccessTokenResponse( $responseBody ) + { + $data = json_decode($responseBody, true); + if( $data === null || !is_array($data) ) { + throw new TokenResponseException( 'Unable to parse response.' ); + } elseif( isset($data['error']) ) { + $err = $data['error']; + throw new TokenResponseException( + "Error in retrieving token: \"$err\"" ); + } + + $token = new StdOAuth2Token( $data['access_token'], null, + $data['expires_in'] ); + + unset( $data['access_token'] ); + unset( $data['expires_in'] ); + + $token->setExtraParams( $data ); + + return $token; + } +} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Bitrix24.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Bitrix24.php index 1630d30..b1fd45b 100644 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Bitrix24.php +++ b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Bitrix24.php @@ -39,6 +39,14 @@ public function getAccessTokenEndpoint() return new Uri(sprintf('%s/oauth/token/', $this->baseApiUri)); } + /** + * {@inheritdoc} + */ + protected function getAuthorizationMethod() + { + return static::AUTHORIZATION_METHOD_QUERY_STRING_V4; + } + /** * {@inheritdoc} */ diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Facebook.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Facebook.php index 9ba610e..4202b8b 100644 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Facebook.php +++ b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Facebook.php @@ -158,8 +158,12 @@ public function getAccessTokenEndpoint() */ protected function parseAccessTokenResponse($responseBody) { - // Facebook gives us a query string ... Oh wait. JSON is too simple, understand ? - parse_str($responseBody, $data); + $data = @json_decode($responseBody, true); + + // Facebook gives us a query string on old api (v2.0) + if (!$data) { + parse_str($responseBody, $data); + } if (null === $data || !is_array($data)) { throw new TokenResponseException('Unable to parse response.'); diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Google.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Google.php index 85c555c..1b6555f 100644 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Google.php +++ b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Google.php @@ -35,6 +35,7 @@ class Google extends AbstractService const SCOPE_GPLUS_STREAM_READ = 'https://www.googleapis.com/auth/plus.stream.read'; const SCOPE_GPLUS_STREAM_WRITE = 'https://www.googleapis.com/auth/plus.stream.write'; const SCOPE_GPLUS_MEDIA = 'https://www.googleapis.com/auth/plus.media.upload'; + const SCOPE_EMAIL_PLUS = 'https://www.googleapis.com/auth/plus.profile.emails.read'; // Google Drive const SCOPE_DOCUMENTSLIST = 'https://docs.google.com/feeds/'; @@ -49,7 +50,8 @@ class Google extends AbstractService // Adwords const SCOPE_ADSENSE = 'https://www.googleapis.com/auth/adsense'; - const SCOPE_ADWORDS = 'https://www.googleapis.com/auth/adwords/'; + const SCOPE_ADWORDS = 'https://www.googleapis.com/auth/adwords'; + const SCOPE_ADWORDS_DEPRECATED = 'https://www.googleapis.com/auth/adwords/'; //deprecated in v201406 API version const SCOPE_GAN = 'https://www.googleapis.com/auth/gan'; // google affiliate network...? //Doubleclick for Publishers diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Mondo.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Mondo.php new file mode 100644 index 0000000..e063045 --- /dev/null +++ b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Mondo.php @@ -0,0 +1,86 @@ +baseApiUri = new Uri('https://api.getmondo.co.uk'); + } + } + + /** + * {@inheritdoc} + */ + public function getAuthorizationEndpoint() + { + return new Uri('https://auth.getmondo.co.uk'); + } + + /** + * {@inheritdoc} + */ + public function getAccessTokenEndpoint() + { + return new Uri('https://api.getmondo.co.uk/oauth2/token'); + } + + /** + * {@inheritdoc} + */ + protected function getAuthorizationMethod() + { + return static::AUTHORIZATION_METHOD_HEADER_BEARER; + } + + /** + * {@inheritdoc} + */ + protected function parseAccessTokenResponse($responseBody) + { + $data = json_decode($responseBody, true); + + if (null === $data || !is_array($data)) { + throw new TokenResponseException('Unable to parse response.'); + } elseif (isset($data['error'])) { + throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); + } + + + $token = new StdOAuth2Token(); + $token->setAccessToken($data['access_token']); + + if (isset($data['expires_in'])) { + $token->setLifetime($data['expires_in']); + unset($data['expires_in']); + } + + if (isset($data['refresh_token'])) { + $token->setRefreshToken($data['refresh_token']); + unset($data['refresh_token']); + } + + unset($data['access_token']); + + $token->setExtraParams($data); + + return $token; + } +} diff --git a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Salesforce.php b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Salesforce.php index a50de11..5edc42c 100644 --- a/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Salesforce.php +++ b/vendor/lusitanian/oauth/src/OAuth/OAuth2/Service/Salesforce.php @@ -34,7 +34,7 @@ public function getAuthorizationEndpoint() */ public function getAccessTokenEndpoint() { - return new Uri('https://na1.salesforce.com/services/oauth2/token'); + return new Uri('https://login.salesforce.com/services/oauth2/token'); } /** diff --git a/vendor/lusitanian/oauth/tests/Mocks/Common/FakeProject/NS/SomeClass.php b/vendor/lusitanian/oauth/tests/Mocks/Common/FakeProject/NS/SomeClass.php deleted file mode 100644 index c033c4e..0000000 --- a/vendor/lusitanian/oauth/tests/Mocks/Common/FakeProject/NS/SomeClass.php +++ /dev/null @@ -1,11 +0,0 @@ -determineRequestUriFromPath($path, $baseApiUri); - } -} diff --git a/vendor/lusitanian/oauth/tests/Mocks/OAuth1/Service/Fake.php b/vendor/lusitanian/oauth/tests/Mocks/OAuth1/Service/Fake.php deleted file mode 100644 index 5dac52e..0000000 --- a/vendor/lusitanian/oauth/tests/Mocks/OAuth1/Service/Fake.php +++ /dev/null @@ -1,57 +0,0 @@ -authorizationMethod = $method; - } - - /** - * Returns a class constant from ServiceInterface defining the authorization method used for the API - * Header is the sane default. - * - * @return int - */ - protected function getAuthorizationMethod() - { - switch($this->authorizationMethod) { - case 'querystring': - return static::AUTHORIZATION_METHOD_QUERY_STRING; - - case 'querystring2': - return static::AUTHORIZATION_METHOD_QUERY_STRING_V2; - - case 'bearer': - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - return parent::getAuthorizationMethod(); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/AutoloaderTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/AutoloaderTest.php deleted file mode 100644 index eebc340..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/AutoloaderTest.php +++ /dev/null @@ -1,126 +0,0 @@ -assertTrue($autoloader->register()); - } - - /** - * @covers OAuth\Common\AutoLoader::__construct - * @covers OAuth\Common\AutoLoader::register - * @covers OAuth\Common\AutoLoader::unregister - */ - public function testUnregister() - { - $autoloader = new AutoLoader('Test', '/'); - - $this->assertTrue($autoloader->register()); - $this->assertTrue($autoloader->unregister()); - } - - /** - * @covers OAuth\Common\AutoLoader::__construct - * @covers OAuth\Common\AutoLoader::register - * @covers OAuth\Common\AutoLoader::load - */ - public function testLoadSuccess() - { - $autoloader = new AutoLoader('FakeProject', dirname(__DIR__) . '/../Mocks/Common'); - - $this->assertTrue($autoloader->register()); - - $someClass = new \FakeProject\NS\SomeClass(); - - $this->assertTrue($someClass->isLoaded()); - } - - /** - * @covers OAuth\Common\AutoLoader::__construct - * @covers OAuth\Common\AutoLoader::register - * @covers OAuth\Common\AutoLoader::load - */ - public function testLoadSuccessExtraSlashedNamespace() - { - $autoloader = new AutoLoader('\\\\FakeProject', dirname(__DIR__) . '/../Mocks/Common'); - - $this->assertTrue($autoloader->register()); - - $someClass = new \FakeProject\NS\SomeClass(); - - $this->assertTrue($someClass->isLoaded()); - } - - /** - * @covers OAuth\Common\AutoLoader::__construct - * @covers OAuth\Common\AutoLoader::register - * @covers OAuth\Common\AutoLoader::load - */ - public function testLoadSuccessExtraForwardSlashedPath() - { - $autoloader = new AutoLoader('FakeProject', dirname(__DIR__) . '/../Mocks/Common//'); - - $this->assertTrue($autoloader->register()); - - $someClass = new \FakeProject\NS\SomeClass(); - - $this->assertTrue($someClass->isLoaded()); - } - - /** - * @covers OAuth\Common\AutoLoader::__construct - * @covers OAuth\Common\AutoLoader::register - * @covers OAuth\Common\AutoLoader::load - */ - public function testLoadSuccessExtraBackwardSlashedPath() - { - $autoloader = new AutoLoader('FakeProject', dirname(__DIR__) . '/../Mocks/Common\\'); - - $this->assertTrue($autoloader->register()); - - $someClass = new \FakeProject\NS\SomeClass(); - - $this->assertTrue($someClass->isLoaded()); - } - - /** - * @covers OAuth\Common\AutoLoader::__construct - * @covers OAuth\Common\AutoLoader::register - * @covers OAuth\Common\AutoLoader::load - */ - public function testLoadSuccessExtraMixedSlashedPath() - { - $autoloader = new AutoLoader('FakeProject', dirname(__DIR__) . '/../Mocks/Common\\\\/\\//'); - - $this->assertTrue($autoloader->register()); - - $someClass = new \FakeProject\NS\SomeClass(); - - $this->assertTrue($someClass->isLoaded()); - } - - /** - * @covers OAuth\Common\AutoLoader::__construct - * @covers OAuth\Common\AutoLoader::register - * @covers OAuth\Common\AutoLoader::load - */ - public function testLoadUnknownClass() - { - $autoloader = new AutoLoader('FakeProject', dirname(__DIR__) . '/../Mocks/Common\\\\/\\//'); - - $this->assertTrue($autoloader->register()); - - $this->assertFalse($autoloader->load('IDontExistClass')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/Consumer/CredentialsTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/Consumer/CredentialsTest.php deleted file mode 100644 index 1a895fb..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/Consumer/CredentialsTest.php +++ /dev/null @@ -1,51 +0,0 @@ -assertInstanceOf('\\OAuth\\Common\\Consumer\\CredentialsInterface', $credentials); - } - - /** - * @covers OAuth\Common\Consumer\Credentials::__construct - * @covers OAuth\Common\Consumer\Credentials::getConsumerId - */ - public function testGetConsumerId() - { - $credentials = new Credentials('foo', 'bar', 'baz'); - - $this->assertSame('foo', $credentials->getConsumerId()); - } - - /** - * @covers OAuth\Common\Consumer\Credentials::__construct - * @covers OAuth\Common\Consumer\Credentials::getConsumerSecret - */ - public function testGetConsumerSecret() - { - $credentials = new Credentials('foo', 'bar', 'baz'); - - $this->assertSame('bar', $credentials->getConsumerSecret()); - } - - /** - * @covers OAuth\Common\Consumer\Credentials::__construct - * @covers OAuth\Common\Consumer\Credentials::getCallbackUrl - */ - public function testGetCallbackUrl() - { - $credentials = new Credentials('foo', 'bar', 'baz'); - - $this->assertSame('baz', $credentials->getCallbackUrl()); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/Http/Client/AbstractClientTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/Http/Client/AbstractClientTest.php deleted file mode 100644 index b353152..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/Http/Client/AbstractClientTest.php +++ /dev/null @@ -1,67 +0,0 @@ -getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient'); - - $this->assertInstanceOf('\\OAuth\\Common\\Http\\Client\\ClientInterface', $client); - } - - /** - * @covers OAuth\Common\Http\Client\AbstractClient::__construct - * @covers OAuth\Common\Http\Client\AbstractClient::setMaxRedirects - */ - public function testSetMaxRedirects() - { - $client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient'); - - $this->assertInstanceOf('\\OAuth\\Common\\Http\\Client\\AbstractClient', $client->setMaxRedirects(10)); - $this->assertInstanceOf('\\OAuth\\Common\\Http\\Client\\ClientInterface', $client->setMaxRedirects(10)); - } - - /** - * @covers OAuth\Common\Http\Client\AbstractClient::__construct - * @covers OAuth\Common\Http\Client\AbstractClient::setTimeout - */ - public function testSetTimeout() - { - $client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient'); - - $this->assertInstanceOf('\\OAuth\\Common\\Http\\Client\\AbstractClient', $client->setTimeout(25)); - $this->assertInstanceOf('\\OAuth\\Common\\Http\\Client\\ClientInterface', $client->setTimeout(25)); - } - - /** - * @covers OAuth\Common\Http\Client\AbstractClient::__construct - * @covers OAuth\Common\Http\Client\AbstractClient::normalizeHeaders - */ - public function testNormalizeHeaders() - { - $client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient'); - - $original = array( - 'lowercasekey' => 'lowercasevalue', - 'UPPERCASEKEY' => 'UPPERCASEVALUE', - 'mIxEdCaSeKey' => 'MiXeDcAsEvAlUe', - '31i71casekey' => '31i71casevalue', - ); - - $goal = array( - 'lowercasekey' => 'Lowercasekey: lowercasevalue', - 'UPPERCASEKEY' => 'Uppercasekey: UPPERCASEVALUE', - 'mIxEdCaSeKey' => 'Mixedcasekey: MiXeDcAsEvAlUe', - '31i71casekey' => '31i71casekey: 31i71casevalue', - ); - - $client->normalizeHeaders($original); - - $this->assertSame($goal, $original); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/Http/Client/CurlClientTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/Http/Client/CurlClientTest.php deleted file mode 100644 index 6258298..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/Http/Client/CurlClientTest.php +++ /dev/null @@ -1,386 +0,0 @@ -assertInstanceOf('\\OAuth\\Common\\Http\\Client\\AbstractClient', $client); - } - - /** - * @covers OAuth\Common\Http\Client\CurlClient::setForceSSL3 - */ - public function testSetForceSSL3() - { - $client = new CurlClient(); - - $this->assertInstanceOf('\\OAuth\\Common\\Http\\Client\\CurlClient', $client->setForceSSL3(true)); - } - - /** - * @covers OAuth\Common\Http\Client\CurlClient::retrieveResponse - */ - public function testRetrieveResponseThrowsExceptionOnGetRequestWithBody() - { - $this->setExpectedException('\\InvalidArgumentException'); - - $client = new CurlClient(); - - $client->retrieveResponse( - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'), - 'foo', - array(), - 'GET' - ); - } - - /** - * @covers OAuth\Common\Http\Client\CurlClient::retrieveResponse - */ - public function testRetrieveResponseThrowsExceptionOnGetRequestWithBodyMethodConvertedToUpper() - { - $this->setExpectedException('\\InvalidArgumentException'); - - $client = new CurlClient(); - - $client->retrieveResponse( - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'), - 'foo', - array(), - 'get' - ); - } - - /** - * @covers OAuth\Common\Http\Client\StreamClient::retrieveResponse - * @covers OAuth\Common\Http\Client\StreamClient::generateStreamContext - */ - public function testRetrieveResponseDefaultUserAgent() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/get')); - - $client = new CurlClient(); - - $response = $client->retrieveResponse( - $endPoint, - '', - array(), - 'get' - ); - - $response = json_decode($response, true); - - $this->assertSame('PHPoAuthLib', $response['headers']['User-Agent']); - } - - /** - * @covers OAuth\Common\Http\Client\StreamClient::retrieveResponse - * @covers OAuth\Common\Http\Client\StreamClient::generateStreamContext - */ - public function testRetrieveResponseCustomUserAgent() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/get')); - - $client = new CurlClient('My Super Awesome Http Client'); - - $response = $client->retrieveResponse( - $endPoint, - '', - array(), - 'get' - ); - - $response = json_decode($response, true); - - $this->assertSame('My Super Awesome Http Client', $response['headers']['User-Agent']); - } - - /** - * @covers OAuth\Common\Http\Client\CurlClient::retrieveResponse - */ - public function testRetrieveResponseWithCustomContentType() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/get')); - - $client = new CurlClient(); - - $response = $client->retrieveResponse( - $endPoint, - '', - array('Content-Type' => 'foo/bar'), - 'get' - ); - - $response = json_decode($response, true); - - $this->assertSame('foo/bar', $response['headers']['Content-Type']); - } - - /** - * @covers OAuth\Common\Http\Client\CurlClient::retrieveResponse - */ - public function testRetrieveResponseWithFormUrlEncodedContentType() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/post')); - - $client = new CurlClient(); - - $response = $client->retrieveResponse( - $endPoint, - array('foo' => 'bar', 'baz' => 'fab'), - array(), - 'POST' - ); - - $response = json_decode($response, true); - - $this->assertSame('application/x-www-form-urlencoded', $response['headers']['Content-Type']); - $this->assertEquals(array('foo' => 'bar', 'baz' => 'fab'), $response['form']); - } - - /** - * @covers OAuth\Common\Http\Client\CurlClient::retrieveResponse - */ - public function testRetrieveResponseHost() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/post')); - - $client = new CurlClient(); - - $response = $client->retrieveResponse( - $endPoint, - array('foo' => 'bar', 'baz' => 'fab'), - array(), - 'POST' - ); - - $response = json_decode($response, true); - - $this->assertSame('httpbin.org', $response['headers']['Host']); - } - - /** - * @covers OAuth\Common\Http\Client\CurlClient::retrieveResponse - */ - public function testRetrieveResponsePostRequestWithRequestBodyAsString() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/post')); - - $formData = array('baz' => 'fab', 'foo' => 'bar'); - - $client = new CurlClient(); - - $response = $client->retrieveResponse( - $endPoint, - $formData, - array(), - 'POST' - ); - - $response = json_decode($response, true); - - $this->assertSame($formData, $response['form']); - } - - /** - * @covers OAuth\Common\Http\Client\CurlClient::retrieveResponse - */ - public function testRetrieveResponsePutRequestWithRequestBodyAsString() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/put')); - - $formData = array('baz' => 'fab', 'foo' => 'bar'); - - $client = new CurlClient(); - - $response = $client->retrieveResponse( - $endPoint, - $formData, - array(), - 'PUT' - ); - - $response = json_decode($response, true); - - $this->assertSame($formData, $response['form']); - } - - /** - * @covers OAuth\Common\Http\Client\CurlClient::retrieveResponse - */ - public function testRetrieveResponsePutRequestWithRequestBodyAsStringNoRedirects() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/put')); - - $formData = array('baz' => 'fab', 'foo' => 'bar'); - - $client = new CurlClient(); - - $client->setMaxRedirects(0); - - $response = $client->retrieveResponse( - $endPoint, - $formData, - array(), - 'PUT' - ); - - $response = json_decode($response, true); - - $this->assertSame($formData, $response['form']); - } - - /** - * @covers OAuth\Common\Http\Client\CurlClient::retrieveResponse - */ - public function testRetrieveResponseWithForcedSsl3() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('https://httpbin.org/get')); - - $client = new CurlClient(); - - $client->setForceSSL3(true); - - try { - $response = $client->retrieveResponse( - $endPoint, - '', - array('Content-Type' => 'foo/bar'), - 'get' - ); - } - catch (TokenResponseException $e) { - if (strpos($e->getMessage(), 'cURL Error # 35') !== false) { - $this->markTestSkipped('SSL peer handshake failed: ' . $e->getMessage()); - } - } - - $response = json_decode($response, true); - - $this->assertSame('foo/bar', $response['headers']['Content-Type']); - } - - /** - * @covers OAuth\Common\Http\Client\CurlClient::retrieveResponse - */ - public function testRetrieveResponseThrowsExceptionOnInvalidUrl() - { - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('jkehfkefcmekjhcnkerjh')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('jkehfkefcmekjhcnkerjh')); - - $client = new CurlClient(); - - $client->setForceSSL3(true); - - $response = $client->retrieveResponse( - $endPoint, - '', - array('Content-Type' => 'foo/bar'), - 'get' - ); - - $response = json_decode($response, true); - - $this->assertSame('foo/bar', $response['headers']['Content-Type']); - } - - public function testAdditionalParameters() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/gzip')); - - $client = new CurlClient(); - $client->setCurlParameters(array( - CURLOPT_ENCODING => 'gzip', - )); - - $response = $client->retrieveResponse( - $endPoint, - '', - array(), - 'get' - ); - - $response = json_decode($response, true); - - $this->assertNotNull($response); - $this->assertSame('gzip', $response['headers']['Accept-Encoding']); - $this->assertTrue($response['gzipped']); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/Http/Client/StreamClientTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/Http/Client/StreamClientTest.php deleted file mode 100644 index f634f40..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/Http/Client/StreamClientTest.php +++ /dev/null @@ -1,283 +0,0 @@ -assertInstanceOf('\\OAuth\\Common\\Http\\Client\\AbstractClient', $client); - } - - /** - * @covers OAuth\Common\Http\Client\StreamClient::retrieveResponse - */ - public function testRetrieveResponseThrowsExceptionOnGetRequestWithBody() - { - $this->setExpectedException('\\InvalidArgumentException'); - - $client = new StreamClient(); - - $client->retrieveResponse( - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'), - 'foo', - array(), - 'GET' - ); - } - - /** - * @covers OAuth\Common\Http\Client\StreamClient::retrieveResponse - */ - public function testRetrieveResponseThrowsExceptionOnGetRequestWithBodyMethodConvertedToUpper() - { - $this->setExpectedException('\\InvalidArgumentException'); - - $client = new StreamClient(); - - $client->retrieveResponse( - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'), - 'foo', - array(), - 'get' - ); - } - - /** - * @covers OAuth\Common\Http\Client\StreamClient::retrieveResponse - * @covers OAuth\Common\Http\Client\StreamClient::generateStreamContext - */ - public function testRetrieveResponseDefaultUserAgent() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/get')); - - $client = new StreamClient(); - - $response = $client->retrieveResponse( - $endPoint, - '', - array(), - 'get' - ); - - $response = json_decode($response, true); - - $this->assertSame('PHPoAuthLib', $response['headers']['User-Agent']); - } - - /** - * @covers OAuth\Common\Http\Client\StreamClient::retrieveResponse - * @covers OAuth\Common\Http\Client\StreamClient::generateStreamContext - */ - public function testRetrieveResponseCustomUserAgent() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/get')); - - $client = new StreamClient('My Super Awesome Http Client'); - - $response = $client->retrieveResponse( - $endPoint, - '', - array(), - 'get' - ); - - $response = json_decode($response, true); - - $this->assertSame('My Super Awesome Http Client', $response['headers']['User-Agent']); - } - - /** - * @covers OAuth\Common\Http\Client\StreamClient::retrieveResponse - * @covers OAuth\Common\Http\Client\StreamClient::generateStreamContext - */ - public function testRetrieveResponseWithCustomContentType() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/get')); - - $client = new StreamClient(); - - $response = $client->retrieveResponse( - $endPoint, - '', - array('Content-Type' => 'foo/bar'), - 'get' - ); - - $response = json_decode($response, true); - - $this->assertSame('foo/bar', $response['headers']['Content-Type']); - } - - /** - * @covers OAuth\Common\Http\Client\StreamClient::retrieveResponse - * @covers OAuth\Common\Http\Client\StreamClient::generateStreamContext - */ - public function testRetrieveResponseWithFormUrlEncodedContentType() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/post')); - - $client = new StreamClient(); - - $response = $client->retrieveResponse( - $endPoint, - array('foo' => 'bar', 'baz' => 'fab'), - array(), - 'POST' - ); - - $response = json_decode($response, true); - - $this->assertSame('application/x-www-form-urlencoded', $response['headers']['Content-Type']); - $this->assertEquals(array('foo' => 'bar', 'baz' => 'fab'), $response['form']); - } - - /** - * @covers OAuth\Common\Http\Client\StreamClient::retrieveResponse - * @covers OAuth\Common\Http\Client\StreamClient::generateStreamContext - */ - public function testRetrieveResponseHost() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/post')); - - $client = new StreamClient(); - - $response = $client->retrieveResponse( - $endPoint, - array('foo' => 'bar', 'baz' => 'fab'), - array(), - 'POST' - ); - - $response = json_decode($response, true); - - $this->assertSame('httpbin.org', $response['headers']['Host']); - } - - /** - * @covers OAuth\Common\Http\Client\StreamClient::retrieveResponse - * @covers OAuth\Common\Http\Client\StreamClient::generateStreamContext - */ - public function testRetrieveResponsePostRequestWithRequestBodyAsString() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/post')); - - $formData = array('baz' => 'fab', 'foo' => 'bar'); - - $client = new StreamClient(); - - $response = $client->retrieveResponse( - $endPoint, - $formData, - array(), - 'POST' - ); - - $response = json_decode($response, true); - - $this->assertSame($formData, $response['form']); - } - - /** - * @covers OAuth\Common\Http\Client\StreamClient::retrieveResponse - * @covers OAuth\Common\Http\Client\StreamClient::generateStreamContext - */ - public function testRetrieveResponsePutRequestWithRequestBodyAsString() - { - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('httpbin.org')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('http://httpbin.org/put')); - - $formData = array('baz' => 'fab', 'foo' => 'bar'); - - $client = new StreamClient(); - - $response = $client->retrieveResponse( - $endPoint, - $formData, - array(), - 'PUT' - ); - - $response = json_decode($response, true); - - $this->assertSame($formData, $response['form']); - } - - /** - * @covers OAuth\Common\Http\Client\StreamClient::retrieveResponse - * @covers OAuth\Common\Http\Client\StreamClient::generateStreamContext - */ - public function testRetrieveResponseThrowsExceptionOnInvalidRequest() - { - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $endPoint = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $endPoint->expects($this->any()) - ->method('getHost') - ->will($this->returnValue('dskjhfckjhekrsfhkehfkreljfrekljfkre')); - $endPoint->expects($this->any()) - ->method('getAbsoluteUri') - ->will($this->returnValue('dskjhfckjhekrsfhkehfkreljfrekljfkre')); - - $client = new StreamClient(); - - $response = $client->retrieveResponse( - $endPoint, - '', - array('Content-Type' => 'foo/bar'), - 'get' - ); - - $response = json_decode($response, true); - - $this->assertSame('foo/bar', $response['headers']['Content-Type']); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/Http/HttpClientsTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/Http/HttpClientsTest.php deleted file mode 100644 index 6fa9eac..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/Http/HttpClientsTest.php +++ /dev/null @@ -1,171 +0,0 @@ - - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -namespace OAuth\Unit\Common\Http; - -use OAuth\Common\Http\Uri\Uri; -use OAuth\Common\Http\Uri\UriInterface; -use OAuth\Common\Http\Client; - -class HttpClientsTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var object|\OAuth\Common\Http\Client\ClientInterface[] - */ - protected $clients; - - public function setUp() - { - $streamClient = new Client\StreamClient(); - $streamClient->setTimeout(3); - - $curlClient = new Client\CurlClient(); - $curlClient->setTimeout(3); - - $this->clients[] = $streamClient; - $this->clients[] = $curlClient; - } - - public function tearDown() - { - foreach ($this->clients as $client) { - unset($client); - } - } - - /** - * Test that extra headers are passed properly - */ - public function testHeaders() - { - $testUri = new Uri('http://httpbin.org/get'); - - $me = $this; - $headerCb = function ($response) use ($me) { - $data = json_decode($response, true); - $me->assertEquals('extraheadertest', $data['headers']['Testingheader']); - }; - - $this->__doTestRetrieveResponse($testUri, array(), array('Testingheader' => 'extraheadertest'), 'GET', $headerCb); - } - - /** - * Tests that we get an exception for a >= 400 status code - */ - public function testException() - { - // sending a post here should get us a 405 which should trigger an exception - $testUri = new Uri('http://httpbin.org/delete'); - foreach ($this->clients as $client) { - $this->setExpectedException('OAuth\Common\Http\Exception\TokenResponseException'); - $client->retrieveResponse($testUri, array('blah' => 'blih')); - } - } - - /** - * Tests the DELETE method - */ - public function testDelete() - { - $testUri = new Uri('http://httpbin.org/delete'); - - $me = $this; - $deleteTestCb = function ($response) use ($me) { - $data = json_decode($response, true); - $me->assertEquals('', $data['data']); - }; - - $this->__doTestRetrieveResponse($testUri, array(), array(), 'DELETE', $deleteTestCb); - } - - /** - * Tests the PUT method - */ - public function testPut() - { - $testUri = new Uri('http://httpbin.org/put'); - - $me = $this; - $putTestCb = function ($response) use ($me) { - // verify the put response - $data = json_decode($response, true); - $me->assertEquals(json_encode(array('testKey' => 'testValue')), $data['data']); - }; - - $this->__doTestRetrieveResponse($testUri, json_encode(array('testKey' => 'testValue')), array('Content-Type' => 'application/json'), 'PUT', $putTestCb); - } - - /** - * Tests the POST method - */ - public function testPost() - { - // http test server - $testUri = new Uri('http://httpbin.org/post'); - - $me = $this; - $postTestCb = function ($response) use ($me) { - // verify the post response - $data = json_decode($response, true); - // note that we check this because the retrieveResponse wrapper function automatically adds a content-type - // if there isn't one and it - $me->assertEquals('testValue', $data['form']['testKey']); - }; - - $this->__doTestRetrieveResponse($testUri, array('testKey' => 'testValue'), array(), 'POST', $postTestCb); - } - - /** - * Expect exception when we try to send a GET request with a body - */ - public function testInvalidGet() - { - $testUri = new Uri('http://site.net'); - - foreach ($this->clients as $client) { - $this->setExpectedException('InvalidArgumentException'); - $client->retrieveResponse($testUri, array('blah' => 'blih'), array(), 'GET'); - } - } - - /** - * Tests the GET method - */ - public function testGet() - { - // test uri - $testUri = new Uri('http://httpbin.org/get?testKey=testValue'); - - $me = $this; - $getTestCb = function ($response) use ($me) { - $data = json_decode($response, true); - $me->assertEquals('testValue', $data['args']['testKey']); - }; - - $this->__doTestRetrieveResponse($testUri, array(), array(), 'GET', $getTestCb); - } - - /** - * Test on all HTTP clients. - * - * @param UriInterface $uri - * @param array $param - * @param array $header - * @param string $method - * @param \Closure $responseCallback - */ - protected function __doTestRetrieveResponse(UriInterface $uri, $param, array $header, $method, $responseCallback) - { - foreach ($this->clients as $client) { - $response = $client->retrieveResponse($uri, $param, $header, $method); - $responseCallback($response, $client); - } - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/Http/Uri/UriFactoryTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/Http/Uri/UriFactoryTest.php deleted file mode 100644 index ea74350..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/Http/Uri/UriFactoryTest.php +++ /dev/null @@ -1,331 +0,0 @@ -assertInstanceOf('\\OAuth\\Common\\Http\\Uri\\UriFactoryInterface', $factory); - } - - /** - * @covers OAuth\Common\Http\Uri\UriFactory::createFromSuperGlobalArray - * @covers OAuth\Common\Http\Uri\UriFactory::attemptProxyStyleParse - */ - public function testCreateFromSuperGlobalArrayUsingProxyStyle() - { - $factory = new UriFactory(); - - $uri = $factory->createFromSuperGlobalArray(array('REQUEST_URI' => 'http://example.com')); - - $this->assertInstanceOf( - '\\OAuth\\Common\\Http\\Uri\\UriInterface', - $uri - ); - - $this->assertSame('http://example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\UriFactory::createFromSuperGlobalArray - * @covers OAuth\Common\Http\Uri\UriFactory::attemptProxyStyleParse - * @covers OAuth\Common\Http\Uri\UriFactory::detectScheme - * @covers OAuth\Common\Http\Uri\UriFactory::detectHost - * @covers OAuth\Common\Http\Uri\UriFactory::detectPort - * @covers OAuth\Common\Http\Uri\UriFactory::detectPath - * @covers OAuth\Common\Http\Uri\UriFactory::detectQuery - * @covers OAuth\Common\Http\Uri\UriFactory::createFromParts - */ - public function testCreateFromSuperGlobalArrayHttp() - { - $factory = new UriFactory(); - - $uri = $factory->createFromSuperGlobalArray(array( - 'HTTPS' => 'off', - 'HTTP_HOST' => 'example.com', - 'REQUEST_URI' => '/foo', - 'QUERY_STRING' => 'param1=value1', - )); - - $this->assertInstanceOf( - '\\OAuth\\Common\\Http\\Uri\\UriInterface', - $uri - ); - - $this->assertSame('http://example.com/foo?param1=value1', $uri->getAbsoluteUri()); - } - - /** - * This looks wonky David. Should the port really fallback to 80 even when supplying https as scheme? - * - * @covers OAuth\Common\Http\Uri\UriFactory::createFromSuperGlobalArray - * @covers OAuth\Common\Http\Uri\UriFactory::attemptProxyStyleParse - * @covers OAuth\Common\Http\Uri\UriFactory::detectScheme - * @covers OAuth\Common\Http\Uri\UriFactory::detectHost - * @covers OAuth\Common\Http\Uri\UriFactory::detectPort - * @covers OAuth\Common\Http\Uri\UriFactory::detectPath - * @covers OAuth\Common\Http\Uri\UriFactory::detectQuery - * @covers OAuth\Common\Http\Uri\UriFactory::createFromParts - */ - public function testCreateFromSuperGlobalArrayHttps() - { - $factory = new UriFactory(); - - $uri = $factory->createFromSuperGlobalArray(array( - 'HTTPS' => 'on', - 'HTTP_HOST' => 'example.com', - 'REQUEST_URI' => '/foo', - 'QUERY_STRING' => 'param1=value1', - )); - - $this->assertInstanceOf( - '\\OAuth\\Common\\Http\\Uri\\UriInterface', - $uri - ); - - $this->assertSame('https://example.com:80/foo?param1=value1', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\UriFactory::createFromSuperGlobalArray - * @covers OAuth\Common\Http\Uri\UriFactory::attemptProxyStyleParse - * @covers OAuth\Common\Http\Uri\UriFactory::detectScheme - * @covers OAuth\Common\Http\Uri\UriFactory::detectHost - * @covers OAuth\Common\Http\Uri\UriFactory::detectPort - * @covers OAuth\Common\Http\Uri\UriFactory::detectPath - * @covers OAuth\Common\Http\Uri\UriFactory::detectQuery - * @covers OAuth\Common\Http\Uri\UriFactory::createFromParts - */ - public function testCreateFromSuperGlobalArrayPortSupplied() - { - $factory = new UriFactory(); - - $uri = $factory->createFromSuperGlobalArray(array( - 'HTTP_HOST' => 'example.com', - 'SERVER_PORT' => 21, - 'REQUEST_URI' => '/foo', - 'QUERY_STRING' => 'param1=value1', - )); - - $this->assertInstanceOf( - '\\OAuth\\Common\\Http\\Uri\\UriInterface', - $uri - ); - - $this->assertSame('http://example.com:21/foo?param1=value1', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\UriFactory::createFromSuperGlobalArray - * @covers OAuth\Common\Http\Uri\UriFactory::attemptProxyStyleParse - * @covers OAuth\Common\Http\Uri\UriFactory::detectScheme - * @covers OAuth\Common\Http\Uri\UriFactory::detectHost - * @covers OAuth\Common\Http\Uri\UriFactory::detectPort - * @covers OAuth\Common\Http\Uri\UriFactory::detectPath - * @covers OAuth\Common\Http\Uri\UriFactory::detectQuery - * @covers OAuth\Common\Http\Uri\UriFactory::createFromParts - */ - public function testCreateFromSuperGlobalArrayPortNotSet() - { - $factory = new UriFactory(); - - $uri = $factory->createFromSuperGlobalArray(array( - 'HTTP_HOST' => 'example.com', - 'REQUEST_URI' => '/foo', - 'QUERY_STRING' => 'param1=value1', - )); - - $this->assertInstanceOf( - '\\OAuth\\Common\\Http\\Uri\\UriInterface', - $uri - ); - - $this->assertSame('http://example.com/foo?param1=value1', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\UriFactory::createFromSuperGlobalArray - * @covers OAuth\Common\Http\Uri\UriFactory::attemptProxyStyleParse - * @covers OAuth\Common\Http\Uri\UriFactory::detectScheme - * @covers OAuth\Common\Http\Uri\UriFactory::detectHost - * @covers OAuth\Common\Http\Uri\UriFactory::detectPort - * @covers OAuth\Common\Http\Uri\UriFactory::detectPath - * @covers OAuth\Common\Http\Uri\UriFactory::detectQuery - * @covers OAuth\Common\Http\Uri\UriFactory::createFromParts - */ - public function testCreateFromSuperGlobalArrayRequestUriSet() - { - $factory = new UriFactory(); - - $uri = $factory->createFromSuperGlobalArray(array( - 'HTTP_HOST' => 'example.com', - 'REQUEST_URI' => '/foo', - 'QUERY_STRING' => 'param1=value1', - )); - - $this->assertInstanceOf( - '\\OAuth\\Common\\Http\\Uri\\UriInterface', - $uri - ); - - $this->assertSame('http://example.com/foo?param1=value1', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\UriFactory::createFromSuperGlobalArray - * @covers OAuth\Common\Http\Uri\UriFactory::attemptProxyStyleParse - * @covers OAuth\Common\Http\Uri\UriFactory::detectScheme - * @covers OAuth\Common\Http\Uri\UriFactory::detectHost - * @covers OAuth\Common\Http\Uri\UriFactory::detectPort - * @covers OAuth\Common\Http\Uri\UriFactory::detectPath - * @covers OAuth\Common\Http\Uri\UriFactory::detectQuery - * @covers OAuth\Common\Http\Uri\UriFactory::createFromParts - */ - public function testCreateFromSuperGlobalArrayRedirectUrlSet() - { - $factory = new UriFactory(); - - $uri = $factory->createFromSuperGlobalArray(array( - 'HTTP_HOST' => 'example.com', - 'REDIRECT_URL' => '/foo', - 'QUERY_STRING' => 'param1=value1', - )); - - $this->assertInstanceOf( - '\\OAuth\\Common\\Http\\Uri\\UriInterface', - $uri - ); - - $this->assertSame('http://example.com/foo?param1=value1', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\UriFactory::createFromSuperGlobalArray - * @covers OAuth\Common\Http\Uri\UriFactory::attemptProxyStyleParse - * @covers OAuth\Common\Http\Uri\UriFactory::detectScheme - * @covers OAuth\Common\Http\Uri\UriFactory::detectHost - * @covers OAuth\Common\Http\Uri\UriFactory::detectPort - * @covers OAuth\Common\Http\Uri\UriFactory::detectPath - * @covers OAuth\Common\Http\Uri\UriFactory::detectQuery - * @covers OAuth\Common\Http\Uri\UriFactory::createFromParts - */ - public function testCreateFromSuperGlobalArrayThrowsExceptionOnDetectingPathMissingIndices() - { - $factory = new UriFactory(); - - $this->setExpectedException('\\RuntimeException'); - - $uri = $factory->createFromSuperGlobalArray(array( - 'HTTP_HOST' => 'example.com', - 'QUERY_STRING' => 'param1=value1', - )); - } - - /** - * @covers OAuth\Common\Http\Uri\UriFactory::createFromSuperGlobalArray - * @covers OAuth\Common\Http\Uri\UriFactory::attemptProxyStyleParse - * @covers OAuth\Common\Http\Uri\UriFactory::detectScheme - * @covers OAuth\Common\Http\Uri\UriFactory::detectHost - * @covers OAuth\Common\Http\Uri\UriFactory::detectPort - * @covers OAuth\Common\Http\Uri\UriFactory::detectPath - * @covers OAuth\Common\Http\Uri\UriFactory::detectQuery - * @covers OAuth\Common\Http\Uri\UriFactory::createFromParts - */ - public function testCreateFromSuperGlobalArrayWithQueryString() - { - $factory = new UriFactory(); - - $uri = $factory->createFromSuperGlobalArray(array( - 'HTTP_HOST' => 'example.com', - 'REQUEST_URI' => '/foo?param1=value1', - 'QUERY_STRING' => 'param1=value1', - )); - - $this->assertInstanceOf( - '\\OAuth\\Common\\Http\\Uri\\UriInterface', - $uri - ); - - $this->assertSame('http://example.com/foo?param1=value1', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\UriFactory::createFromSuperGlobalArray - * @covers OAuth\Common\Http\Uri\UriFactory::attemptProxyStyleParse - * @covers OAuth\Common\Http\Uri\UriFactory::detectScheme - * @covers OAuth\Common\Http\Uri\UriFactory::detectHost - * @covers OAuth\Common\Http\Uri\UriFactory::detectPort - * @covers OAuth\Common\Http\Uri\UriFactory::detectPath - * @covers OAuth\Common\Http\Uri\UriFactory::detectQuery - * @covers OAuth\Common\Http\Uri\UriFactory::createFromParts - */ - public function testCreateFromSuperGlobalArrayWithoutQueryString() - { - $factory = new UriFactory(); - - $uri = $factory->createFromSuperGlobalArray(array( - 'HTTP_HOST' => 'example.com', - 'REQUEST_URI' => '/foo', - )); - - $this->assertInstanceOf( - '\\OAuth\\Common\\Http\\Uri\\UriInterface', - $uri - ); - - $this->assertSame('http://example.com/foo', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\UriFactory::createFromSuperGlobalArray - * @covers OAuth\Common\Http\Uri\UriFactory::attemptProxyStyleParse - * @covers OAuth\Common\Http\Uri\UriFactory::detectScheme - * @covers OAuth\Common\Http\Uri\UriFactory::detectHost - * @covers OAuth\Common\Http\Uri\UriFactory::detectPort - * @covers OAuth\Common\Http\Uri\UriFactory::detectPath - * @covers OAuth\Common\Http\Uri\UriFactory::detectQuery - * @covers OAuth\Common\Http\Uri\UriFactory::createFromParts - */ - public function testCreateFromSuperGlobalArrayHostWithColon() - { - $factory = new UriFactory(); - - $uri = $factory->createFromSuperGlobalArray(array( - 'HTTP_HOST' => 'example.com:80', - 'REQUEST_URI' => '/foo', - )); - - $this->assertInstanceOf( - '\\OAuth\\Common\\Http\\Uri\\UriInterface', - $uri - ); - - $this->assertSame('http://example.com/foo', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\UriFactory::createFromAbsolute - */ - public function testCreateFromAbsolute() - { - $factory = new UriFactory(); - - $uri = $factory->createFromAbsolute('http://example.com'); - - $this->assertInstanceOf( - '\\OAuth\\Common\\Http\\Uri\\UriInterface', - $uri - ); - - $this->assertSame('http://example.com', $uri->getAbsoluteUri()); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/Http/Uri/UriTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/Http/Uri/UriTest.php deleted file mode 100644 index bc158ff..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/Http/Uri/UriTest.php +++ /dev/null @@ -1,898 +0,0 @@ -assertInstanceOf('\\OAuth\\Common\\Http\\Uri\\UriInterface', $uri); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - */ - public function testConstructThrowsExceptionOnInvalidUri() - { - $this->setExpectedException('\\InvalidArgumentException'); - - // http://lxr.php.net/xref/PHP_5_4/ext/standard/tests/url/urls.inc#92 - $uri = new Uri('http://@:/'); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - */ - public function testConstructThrowsExceptionOnUriWithoutScheme() - { - $this->setExpectedException('\\InvalidArgumentException'); - - $uri = new Uri('www.pieterhordijk.com'); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getScheme - */ - public function testGetScheme() - { - $uri = new Uri('http://example.com'); - - $this->assertSame('http', $uri->getScheme()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setUserInfo - * @covers OAuth\Common\Http\Uri\Uri::protectUserInfo - * @covers OAuth\Common\Http\Uri\Uri::getUserInfo - */ - public function testGetUserInfo() - { - $uri = new Uri('http://peehaa@example.com'); - - $this->assertSame('peehaa', $uri->getUserInfo()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setUserInfo - * @covers OAuth\Common\Http\Uri\Uri::protectUserInfo - * @covers OAuth\Common\Http\Uri\Uri::getUserInfo - */ - public function testGetUserInfoWithPass() - { - $uri = new Uri('http://peehaa:pass@example.com'); - - $this->assertSame('peehaa:********', $uri->getUserInfo()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setUserInfo - * @covers OAuth\Common\Http\Uri\Uri::protectUserInfo - * @covers OAuth\Common\Http\Uri\Uri::getRawUserInfo - */ - public function testGetRawUserInfo() - { - $uri = new Uri('http://peehaa@example.com'); - - $this->assertSame('peehaa', $uri->getRawUserInfo()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setUserInfo - * @covers OAuth\Common\Http\Uri\Uri::protectUserInfo - * @covers OAuth\Common\Http\Uri\Uri::getRawUserInfo - */ - public function testGetRawUserInfoWithPass() - { - $uri = new Uri('http://peehaa:pass@example.com'); - - $this->assertSame('peehaa:pass', $uri->getRawUserInfo()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getHost - */ - public function testGetHost() - { - $uri = new Uri('http://example.com'); - - $this->assertSame('example.com', $uri->getHost()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getPort - */ - public function testGetPortImplicitHttp() - { - $uri = new Uri('http://example.com'); - - $this->assertSame(80, $uri->getPort()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getPort - */ - public function testGetPortImplicitHttps() - { - $uri = new Uri('https://example.com'); - - $this->assertSame(443, $uri->getPort()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getPort - */ - public function testGetPortExplicit() - { - $uri = new Uri('http://example.com:21'); - - $this->assertSame(21, $uri->getPort()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getPath - */ - public function testGetPathNotSupplied() - { - $uri = new Uri('http://example.com'); - - $this->assertSame('/', $uri->getPath()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getPath - */ - public function testGetPathSlash() - { - $uri = new Uri('http://example.com/'); - - $this->assertSame('/', $uri->getPath()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getPath - */ - public function testGetPath() - { - $uri = new Uri('http://example.com/foo'); - - $this->assertSame('/foo', $uri->getPath()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getQuery - */ - public function testGetQueryWithParams() - { - $uri = new Uri('http://example.com?param1=first¶m2=second'); - - $this->assertSame('param1=first¶m2=second', $uri->getQuery()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getQuery - */ - public function testGetQueryWithoutParams() - { - $uri = new Uri('http://example.com'); - - $this->assertSame('', $uri->getQuery()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getFragment - */ - public function testGetFragmentExists() - { - $uri = new Uri('http://example.com#foo'); - - $this->assertSame('foo', $uri->getFragment()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getFragment - */ - public function testGetFragmentNotExists() - { - $uri = new Uri('http://example.com'); - - $this->assertSame('', $uri->getFragment()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getAuthority - */ - public function testGetAuthorityWithoutUserInfo() - { - $uri = new Uri('http://example.com'); - - $this->assertSame('example.com', $uri->getAuthority()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getAuthority - */ - public function testGetAuthorityWithoutUserInfoWithExplicitPort() - { - $uri = new Uri('http://example.com:21'); - - $this->assertSame('example.com:21', $uri->getAuthority()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setUserInfo - * @covers OAuth\Common\Http\Uri\Uri::protectUserInfo - * @covers OAuth\Common\Http\Uri\Uri::getAuthority - */ - public function testGetAuthorityWithUsernameWithExplicitPort() - { - $uri = new Uri('http://peehaa@example.com:21'); - - $this->assertSame('peehaa@example.com:21', $uri->getAuthority()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setUserInfo - * @covers OAuth\Common\Http\Uri\Uri::protectUserInfo - * @covers OAuth\Common\Http\Uri\Uri::getAuthority - */ - public function testGetAuthorityWithUsernameAndPassWithExplicitPort() - { - $uri = new Uri('http://peehaa:pass@example.com:21'); - - $this->assertSame('peehaa:********@example.com:21', $uri->getAuthority()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setUserInfo - * @covers OAuth\Common\Http\Uri\Uri::protectUserInfo - * @covers OAuth\Common\Http\Uri\Uri::getAuthority - */ - public function testGetAuthorityWithUsernameAndPassWithoutExplicitPort() - { - $uri = new Uri('http://peehaa:pass@example.com'); - - $this->assertSame('peehaa:********@example.com', $uri->getAuthority()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getRawAuthority - */ - public function testGetRawAuthorityWithoutUserInfo() - { - $uri = new Uri('http://example.com'); - - $this->assertSame('example.com', $uri->getRawAuthority()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getRawAuthority - */ - public function testGetRawAuthorityWithoutUserInfoWithExplicitPort() - { - $uri = new Uri('http://example.com:21'); - - $this->assertSame('example.com:21', $uri->getRawAuthority()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setUserInfo - * @covers OAuth\Common\Http\Uri\Uri::protectUserInfo - * @covers OAuth\Common\Http\Uri\Uri::getRawAuthority - */ - public function testGetRawAuthorityWithUsernameWithExplicitPort() - { - $uri = new Uri('http://peehaa@example.com:21'); - - $this->assertSame('peehaa@example.com:21', $uri->getRawAuthority()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setUserInfo - * @covers OAuth\Common\Http\Uri\Uri::protectUserInfo - * @covers OAuth\Common\Http\Uri\Uri::getRawAuthority - */ - public function testGetRawAuthorityWithUsernameAndPassWithExplicitPort() - { - $uri = new Uri('http://peehaa:pass@example.com:21'); - - $this->assertSame('peehaa:pass@example.com:21', $uri->getRawAuthority()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setUserInfo - * @covers OAuth\Common\Http\Uri\Uri::protectUserInfo - * @covers OAuth\Common\Http\Uri\Uri::getRawAuthority - */ - public function testGetRawAuthorityWithUsernameAndPassWithoutExplicitPort() - { - $uri = new Uri('http://peehaa:pass@example.com'); - - $this->assertSame('peehaa:pass@example.com', $uri->getRawAuthority()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testGetAbsoluteUriBare() - { - $uri = new Uri('http://example.com'); - - $this->assertSame('http://example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setUserInfo - * @covers OAuth\Common\Http\Uri\Uri::protectUserInfo - * @covers OAuth\Common\Http\Uri\Uri::getRawAuthority - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testGetAbsoluteUriWithAuthority() - { - $uri = new Uri('http://peehaa:pass@example.com'); - - $this->assertSame('http://peehaa:pass@example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testGetAbsoluteUriWithPath() - { - $uri = new Uri('http://example.com/foo'); - - $this->assertSame('http://example.com/foo', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testGetAbsoluteUriWithoutPath() - { - $uri = new Uri('http://example.com'); - - $this->assertSame('http://example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testGetAbsoluteUriWithoutPathExplicitTrailingSlash() - { - $uri = new Uri('http://example.com/'); - - $this->assertSame('http://example.com/', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testGetAbsoluteUriWithQuery() - { - $uri = new Uri('http://example.com?param1=value1'); - - $this->assertSame('http://example.com?param1=value1', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testGetAbsoluteUriWithFragment() - { - $uri = new Uri('http://example.com#foo'); - - $this->assertSame('http://example.com#foo', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getRelativeUri - */ - public function testGetRelativeUriWithoutPath() - { - $uri = new Uri('http://example.com'); - - $this->assertSame('', $uri->getRelativeUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getRelativeUri - */ - public function testGetRelativeUriWithPath() - { - $uri = new Uri('http://example.com/foo'); - - $this->assertSame('/foo', $uri->getRelativeUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::getRelativeUri - */ - public function testGetRelativeUriWithExplicitTrailingSlash() - { - $uri = new Uri('http://example.com/'); - - $this->assertSame('/', $uri->getRelativeUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::__toString - */ - public function testToStringBare() - { - $uri = new Uri('http://example.com'); - - $this->assertSame('http://example.com', (string) $uri); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setUserInfo - * @covers OAuth\Common\Http\Uri\Uri::protectUserInfo - * @covers OAuth\Common\Http\Uri\Uri::getRawAuthority - * @covers OAuth\Common\Http\Uri\Uri::__toString - */ - public function testToStringWithAuthority() - { - $uri = new Uri('http://peehaa:pass@example.com'); - - $this->assertSame('http://peehaa:********@example.com', (string) $uri); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::__toString - */ - public function testToStringWithPath() - { - $uri = new Uri('http://example.com/foo'); - - $this->assertSame('http://example.com/foo', (string) $uri); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::__toString - */ - public function testToStringWithoutPath() - { - $uri = new Uri('http://example.com'); - - $this->assertSame('http://example.com', (string) $uri); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::__toString - */ - public function testToStringWithoutPathExplicitTrailingSlash() - { - $uri = new Uri('http://example.com/'); - - $this->assertSame('http://example.com/', (string) $uri); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::__toString - */ - public function testToStringWithQuery() - { - $uri = new Uri('http://example.com?param1=value1'); - - $this->assertSame('http://example.com?param1=value1', (string) $uri); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::__toString - */ - public function testToStringWithFragment() - { - $uri = new Uri('http://example.com#foo'); - - $this->assertSame('http://example.com#foo', (string) $uri); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setPath - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetPathEmpty() - { - $uri = new Uri('http://example.com'); - $uri->setPath(''); - - $this->assertSame('http://example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setPath - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetPathWithPath() - { - $uri = new Uri('http://example.com'); - $uri->setPath('/foo'); - - $this->assertSame('http://example.com/foo', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setPath - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetPathWithOnlySlash() - { - $uri = new Uri('http://example.com'); - $uri->setPath('/'); - - $this->assertSame('http://example.com/', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setQuery - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetQueryEmpty() - { - $uri = new Uri('http://example.com'); - $uri->setQuery(''); - - $this->assertSame('http://example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setQuery - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetQueryFilled() - { - $uri = new Uri('http://example.com'); - $uri->setQuery('param1=value1¶m2=value2'); - - $this->assertSame('http://example.com?param1=value1¶m2=value2', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::addToQuery - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testAddToQueryAppend() - { - $uri = new Uri('http://example.com?param1=value1'); - $uri->addToQuery('param2', 'value2'); - - $this->assertSame('http://example.com?param1=value1¶m2=value2', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::addToQuery - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testAddToQueryCreate() - { - $uri = new Uri('http://example.com'); - $uri->addToQuery('param1', 'value1'); - - $this->assertSame('http://example.com?param1=value1', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setFragment - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetFragmentEmpty() - { - $uri = new Uri('http://example.com'); - $uri->setFragment(''); - - $this->assertSame('http://example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setFragment - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetFragmentWithData() - { - $uri = new Uri('http://example.com'); - $uri->setFragment('foo'); - - $this->assertSame('http://example.com#foo', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setScheme - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetSchemeWithEmpty() - { - $uri = new Uri('http://example.com'); - $uri->setScheme(''); - - $this->assertSame('://example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setScheme - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetSchemeWithData() - { - $uri = new Uri('http://example.com'); - $uri->setScheme('foo'); - - $this->assertSame('foo://example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setUserInfo - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetUserInfoEmpty() - { - $uri = new Uri('http://example.com'); - $uri->setUserInfo(''); - - $this->assertSame('http://example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setUserInfo - * @covers OAuth\Common\Http\Uri\Uri::protectUserInfo - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetUserInfoWithData() - { - $uri = new Uri('http://example.com'); - $uri->setUserInfo('foo:bar'); - - $this->assertSame('http://foo:bar@example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setPort - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetPortCustom() - { - $uri = new Uri('http://example.com'); - $uri->setPort('21'); - - $this->assertSame('http://example.com:21', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setPort - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetPortHttpImplicit() - { - $uri = new Uri('http://example.com'); - $uri->setPort(80); - - $this->assertSame('http://example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setPort - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetPortHttpsImplicit() - { - $uri = new Uri('https://example.com'); - $uri->setPort(443); - - $this->assertSame('https://example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setPort - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetPortHttpExplicit() - { - $uri = new Uri('http://example.com'); - $uri->setPort(443); - - $this->assertSame('http://example.com:443', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setPort - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetPortHttpsExplicit() - { - $uri = new Uri('https://example.com'); - $uri->setPort(80); - - $this->assertSame('https://example.com:80', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::setHost - * @covers OAuth\Common\Http\Uri\Uri::getAbsoluteUri - */ - public function testSetHost() - { - $uri = new Uri('http://example.com'); - $uri->setHost('pieterhordijk.com'); - - $this->assertSame('http://pieterhordijk.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::hasExplicitTrailingHostSlash - */ - public function testHasExplicitTrailingHostSlashTrue() - { - $uri = new Uri('http://example.com/'); - - $this->assertTrue($uri->hasExplicitTrailingHostSlash()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::hasExplicitTrailingHostSlash - */ - public function testHasExplicitTrailingHostSlashFalse() - { - $uri = new Uri('http://example.com/foo'); - - $this->assertFalse($uri->hasExplicitTrailingHostSlash()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::hasExplicitPortSpecified - */ - public function testHasExplicitPortSpecifiedTrue() - { - $uri = new Uri('http://example.com:8080'); - - $this->assertTrue($uri->hasExplicitPortSpecified()); - } - - /** - * @covers OAuth\Common\Http\Uri\Uri::__construct - * @covers OAuth\Common\Http\Uri\Uri::parseUri - * @covers OAuth\Common\Http\Uri\Uri::hasExplicitPortSpecified - */ - public function testHasExplicitPortSpecifiedFalse() - { - $uri = new Uri('http://example.com'); - - $this->assertFalse($uri->hasExplicitPortSpecified()); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/Service/AbstractServiceTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/Service/AbstractServiceTest.php deleted file mode 100644 index 2d8bff4..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/Service/AbstractServiceTest.php +++ /dev/null @@ -1,171 +0,0 @@ -getMockForAbstractClass( - '\\OAuth\\Common\\Service\\AbstractService', - array( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ) - ); - - $this->assertInstanceOf('\\OAuth\\Common\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\Common\Service\AbstractService::__construct - * @covers OAuth\Common\Service\AbstractService::getStorage - */ - public function testGetStorage() - { - $service = $this->getMockForAbstractClass( - '\\OAuth\\Common\\Service\\AbstractService', - array( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ) - ); - - $this->assertInstanceOf('\\OAuth\\Common\\Storage\\TokenStorageInterface', $service->getStorage()); - } - - /** - * @covers OAuth\Common\Service\AbstractService::__construct - * @covers OAuth\Common\Service\AbstractService::service - */ - public function testService() - { - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('Mock', $service->service()); - } - - /** - * @covers OAuth\Common\Service\AbstractService::__construct - * @covers OAuth\Common\Service\AbstractService::determineRequestUriFromPath - */ - public function testDetermineRequestUriFromPathUsingUriObject() - { - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf( - '\\OAuth\\Common\\Http\\Uri\\UriInterface', - $service->testDetermineRequestUriFromPath($this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface')) - ); - } - - /** - * @covers OAuth\Common\Service\AbstractService::__construct - * @covers OAuth\Common\Service\AbstractService::determineRequestUriFromPath - */ - public function testDetermineRequestUriFromPathUsingHttpPath() - { - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $uri = $service->testDetermineRequestUriFromPath('http://example.com'); - - $this->assertInstanceOf('\\OAuth\\Common\\Http\\Uri\\UriInterface', $uri); - $this->assertSame('http://example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Service\AbstractService::__construct - * @covers OAuth\Common\Service\AbstractService::determineRequestUriFromPath - */ - public function testDetermineRequestUriFromPathUsingHttpsPath() - { - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $uri = $service->testDetermineRequestUriFromPath('https://example.com'); - - $this->assertInstanceOf('\\OAuth\\Common\\Http\\Uri\\UriInterface', $uri); - $this->assertSame('https://example.com', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Service\AbstractService::__construct - * @covers OAuth\Common\Service\AbstractService::determineRequestUriFromPath - */ - public function testDetermineRequestUriFromPathThrowsExceptionOnInvalidUri() - { - $this->setExpectedException('\\OAuth\\Common\\Exception\\Exception'); - - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $uri = $service->testDetermineRequestUriFromPath('example.com'); - } - - /** - * @covers OAuth\Common\Service\AbstractService::__construct - * @covers OAuth\Common\Service\AbstractService::determineRequestUriFromPath - */ - public function testDetermineRequestUriFromPathWithQueryString() - { - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $uri = $service->testDetermineRequestUriFromPath( - 'path?param1=value1', - new \OAuth\Common\Http\Uri\Uri('https://example.com') - ); - - $this->assertInstanceOf('\\OAuth\\Common\\Http\\Uri\\UriInterface', $uri); - $this->assertSame('https://example.com/path?param1=value1', $uri->getAbsoluteUri()); - } - - /** - * @covers OAuth\Common\Service\AbstractService::__construct - * @covers OAuth\Common\Service\AbstractService::determineRequestUriFromPath - */ - public function testDetermineRequestUriFromPathWithLeadingSlashInPath() - { - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $uri = $service->testDetermineRequestUriFromPath( - '/path', - new \OAuth\Common\Http\Uri\Uri('https://example.com') - ); - - $this->assertInstanceOf('\\OAuth\\Common\\Http\\Uri\\UriInterface', $uri); - $this->assertSame('https://example.com/path', $uri->getAbsoluteUri()); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/Storage/MemoryTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/Storage/MemoryTest.php deleted file mode 100644 index 93a01a7..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/Storage/MemoryTest.php +++ /dev/null @@ -1,132 +0,0 @@ -assertInstanceOf('\\OAuth\\Common\\Storage\\TokenStorageInterface', $storage); - } - - /** - * @covers OAuth\Common\Storage\Memory::__construct - * @covers OAuth\Common\Storage\Memory::storeAccessToken - */ - public function testStoreAccessToken() - { - $storage = new Memory(); - - $this->assertInstanceOf( - '\\OAuth\\Common\\Storage\\Memory', - $storage->storeAccessToken('foo', $this->getMock('\\OAuth\\Common\\Token\\TokenInterface')) - ); - } - - /** - * @covers OAuth\Common\Storage\Memory::__construct - * @covers OAuth\Common\Storage\Memory::storeAccessToken - * @covers OAuth\Common\Storage\Memory::retrieveAccessToken - * @covers OAuth\Common\Storage\Memory::hasAccessToken - */ - public function testRetrieveAccessTokenValid() - { - $storage = new Memory(); - - $storage->storeAccessToken('foo', $this->getMock('\\OAuth\\Common\\Token\\TokenInterface')); - - $this->assertInstanceOf('\\OAuth\\Common\\Token\\TokenInterface', $storage->retrieveAccessToken('foo')); - } - - /** - * @covers OAuth\Common\Storage\Memory::__construct - * @covers OAuth\Common\Storage\Memory::retrieveAccessToken - * @covers OAuth\Common\Storage\Memory::hasAccessToken - */ - public function testRetrieveAccessTokenThrowsExceptionWhenTokenIsNotFound() - { - $this->setExpectedException('\\OAuth\\Common\\Storage\\Exception\\TokenNotFoundException'); - - $storage = new Memory(); - - $storage->retrieveAccessToken('foo'); - } - - /** - * @covers OAuth\Common\Storage\Memory::__construct - * @covers OAuth\Common\Storage\Memory::storeAccessToken - * @covers OAuth\Common\Storage\Memory::hasAccessToken - */ - public function testHasAccessTokenTrue() - { - $storage = new Memory(); - - $storage->storeAccessToken('foo', $this->getMock('\\OAuth\\Common\\Token\\TokenInterface')); - - $this->assertTrue($storage->hasAccessToken('foo')); - } - - /** - * @covers OAuth\Common\Storage\Memory::__construct - * @covers OAuth\Common\Storage\Memory::hasAccessToken - */ - public function testHasAccessTokenFalse() - { - $storage = new Memory(); - - $this->assertFalse($storage->hasAccessToken('foo')); - } - - /** - * @covers OAuth\Common\Storage\Memory::__construct - * @covers OAuth\Common\Storage\Memory::clearToken - */ - public function testClearTokenIsNotSet() - { - $storage = new Memory(); - - $this->assertInstanceOf('\\OAuth\\Common\\Storage\\Memory', $storage->clearToken('foo')); - } - - /** - * @covers OAuth\Common\Storage\Memory::__construct - * @covers OAuth\Common\Storage\Memory::storeAccessToken - * @covers OAuth\Common\Storage\Memory::clearToken - */ - public function testClearTokenSet() - { - $storage = new Memory(); - - $storage->storeAccessToken('foo', $this->getMock('\\OAuth\\Common\\Token\\TokenInterface')); - - $this->assertTrue($storage->hasAccessToken('foo')); - $this->assertInstanceOf('\\OAuth\\Common\\Storage\\Memory', $storage->clearToken('foo')); - $this->assertFalse($storage->hasAccessToken('foo')); - } - - /** - * @covers OAuth\Common\Storage\Memory::__construct - * @covers OAuth\Common\Storage\Memory::storeAccessToken - * @covers OAuth\Common\Storage\Memory::clearAllTokens - */ - public function testClearAllTokens() - { - $storage = new Memory(); - - $storage->storeAccessToken('foo', $this->getMock('\\OAuth\\Common\\Token\\TokenInterface')); - $storage->storeAccessToken('bar', $this->getMock('\\OAuth\\Common\\Token\\TokenInterface')); - - $this->assertTrue($storage->hasAccessToken('foo')); - $this->assertTrue($storage->hasAccessToken('bar')); - $this->assertInstanceOf('\\OAuth\\Common\\Storage\\Memory', $storage->clearAllTokens()); - $this->assertFalse($storage->hasAccessToken('foo')); - $this->assertFalse($storage->hasAccessToken('bar')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/Storage/RedisTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/Storage/RedisTest.php deleted file mode 100644 index 83e7a28..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/Storage/RedisTest.php +++ /dev/null @@ -1,102 +0,0 @@ - - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -namespace OAuth\Unit\Common\Storage; - -use OAuth\Common\Storage\Redis; -use Predis\Client as Predis; -use OAuth\OAuth2\Token\StdOAuth2Token; - -class RedisTest extends \PHPUnit_Framework_TestCase -{ - protected $storage; - - public function setUp() - { - // connect to a redis daemon - $predis = new Predis(array( - 'host' => $_ENV['redis_host'], - 'port' => $_ENV['redis_port'], - )); - - // set it - $this->storage = new Redis($predis, 'test_user_token', 'test_user_state'); - - try { - $predis->connect(); - } catch (\Predis\Connection\ConnectionException $e) { - $this->markTestSkipped('No redis instance available: ' . $e->getMessage()); - } - } - - public function tearDown() - { - // delete - $this->storage->clearAllTokens(); - - // close connection - $this->storage->getRedis()->quit(); - } - - /** - * Check that the token gets properly stored. - */ - public function testStorage() - { - // arrange - $service_1 = 'Facebook'; - $service_2 = 'Foursquare'; - - $token_1 = new StdOAuth2Token('access_1', 'refresh_1', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param')); - $token_2 = new StdOAuth2Token('access_2', 'refresh_2', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param')); - - // act - $this->storage->storeAccessToken($service_1, $token_1); - $this->storage->storeAccessToken($service_2, $token_2); - - // assert - $extraParams = $this->storage->retrieveAccessToken($service_1)->getExtraParams(); - $this->assertEquals('param', $extraParams['extra']); - $this->assertEquals($token_1, $this->storage->retrieveAccessToken($service_1)); - $this->assertEquals($token_2, $this->storage->retrieveAccessToken($service_2)); - } - - /** - * Test hasAccessToken. - */ - public function testHasAccessToken() - { - // arrange - $service = 'Facebook'; - $this->storage->clearToken($service); - - // act - // assert - $this->assertFalse($this->storage->hasAccessToken($service)); - } - - /** - * Check that the token gets properly deleted. - */ - public function testStorageClears() - { - // arrange - $service = 'Facebook'; - $token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param')); - - // act - $this->storage->storeAccessToken($service, $token); - $this->storage->clearToken($service); - - // assert - $this->setExpectedException('OAuth\Common\Storage\Exception\TokenNotFoundException'); - $this->storage->retrieveAccessToken($service); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/Storage/SessionTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/Storage/SessionTest.php deleted file mode 100644 index 72f38b1..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/Storage/SessionTest.php +++ /dev/null @@ -1,245 +0,0 @@ -assertInstanceOf('\\OAuth\\Common\\Storage\\TokenStorageInterface', $storage); - } - - /** - * @covers OAuth\Common\Storage\Session::__construct - * - * @runInSeparateProcess - */ - public function testConstructWithoutStartingSession() - { - session_start(); - - $storage = new Session(false); - - $this->assertInstanceOf('\\OAuth\\Common\\Storage\\TokenStorageInterface', $storage); - } - - /** - * @covers OAuth\Common\Storage\Session::__construct - * - * @runInSeparateProcess - */ - public function testConstructTryingToStartWhileSessionAlreadyExists() - { - session_start(); - - $storage = new Session(); - - $this->assertInstanceOf('\\OAuth\\Common\\Storage\\TokenStorageInterface', $storage); - } - - /** - * @covers OAuth\Common\Storage\Session::__construct - * - * @runInSeparateProcess - */ - public function testConstructWithExistingSessionKey() - { - session_start(); - - $_SESSION['lusitanian_oauth_token'] = array(); - - $storage = new Session(); - - $this->assertInstanceOf('\\OAuth\\Common\\Storage\\TokenStorageInterface', $storage); - } - - /** - * @covers OAuth\Common\Storage\Session::__construct - * @covers OAuth\Common\Storage\Session::storeAccessToken - * - * @runInSeparateProcess - */ - public function testStoreAccessTokenIsAlreadyArray() - { - $storage = new Session(); - - $this->assertInstanceOf( - '\\OAuth\\Common\\Storage\\Session', - $storage->storeAccessToken('foo', $this->getMock('\\OAuth\\Common\\Token\\TokenInterface')) - ); - } - - /** - * @covers OAuth\Common\Storage\Session::__construct - * @covers OAuth\Common\Storage\Session::storeAccessToken - * - * @runInSeparateProcess - */ - public function testStoreAccessTokenIsNotArray() - { - $storage = new Session(); - - $_SESSION['lusitanian_oauth_token'] = 'foo'; - - $this->assertInstanceOf( - '\\OAuth\\Common\\Storage\\Session', - $storage->storeAccessToken('foo', $this->getMock('\\OAuth\\Common\\Token\\TokenInterface')) - ); - } - - /** - * @covers OAuth\Common\Storage\Session::__construct - * @covers OAuth\Common\Storage\Session::storeAccessToken - * @covers OAuth\Common\Storage\Session::retrieveAccessToken - * @covers OAuth\Common\Storage\Session::hasAccessToken - * - * @runInSeparateProcess - */ - public function testRetrieveAccessTokenValid() - { - $storage = new Session(); - - $storage->storeAccessToken('foo', $this->getMock('\\OAuth\\Common\\Token\\TokenInterface')); - - $this->assertInstanceOf('\\OAuth\\Common\\Token\\TokenInterface', $storage->retrieveAccessToken('foo')); - } - - /** - * @covers OAuth\Common\Storage\Session::__construct - * @covers OAuth\Common\Storage\Session::retrieveAccessToken - * @covers OAuth\Common\Storage\Session::hasAccessToken - * - * @runInSeparateProcess - */ - public function testRetrieveAccessTokenThrowsExceptionWhenTokenIsNotFound() - { - $this->setExpectedException('\\OAuth\\Common\\Storage\\Exception\\TokenNotFoundException'); - - $storage = new Session(); - - $storage->retrieveAccessToken('foo'); - } - - /** - * @covers OAuth\Common\Storage\Session::__construct - * @covers OAuth\Common\Storage\Session::storeAccessToken - * @covers OAuth\Common\Storage\Session::hasAccessToken - * - * @runInSeparateProcess - */ - public function testHasAccessTokenTrue() - { - $storage = new Session(); - - $storage->storeAccessToken('foo', $this->getMock('\\OAuth\\Common\\Token\\TokenInterface')); - - $this->assertTrue($storage->hasAccessToken('foo')); - } - - /** - * @covers OAuth\Common\Storage\Session::__construct - * @covers OAuth\Common\Storage\Session::hasAccessToken - * - * @runInSeparateProcess - */ - public function testHasAccessTokenFalse() - { - $storage = new Session(); - - $this->assertFalse($storage->hasAccessToken('foo')); - } - - /** - * @covers OAuth\Common\Storage\Session::__construct - * @covers OAuth\Common\Storage\Session::clearToken - * - * @runInSeparateProcess - */ - public function testClearTokenIsNotSet() - { - $storage = new Session(); - - $this->assertInstanceOf('\\OAuth\\Common\\Storage\\Session', $storage->clearToken('foo')); - } - - /** - * @covers OAuth\Common\Storage\Session::__construct - * @covers OAuth\Common\Storage\Session::storeAccessToken - * @covers OAuth\Common\Storage\Session::clearToken - * - * @runInSeparateProcess - */ - public function testClearTokenSet() - { - $storage = new Session(); - - $storage->storeAccessToken('foo', $this->getMock('\\OAuth\\Common\\Token\\TokenInterface')); - - $this->assertTrue($storage->hasAccessToken('foo')); - $this->assertInstanceOf('\\OAuth\\Common\\Storage\\Session', $storage->clearToken('foo')); - $this->assertFalse($storage->hasAccessToken('foo')); - } - - /** - * @covers OAuth\Common\Storage\Session::__construct - * @covers OAuth\Common\Storage\Session::storeAccessToken - * @covers OAuth\Common\Storage\Session::clearAllTokens - * - * @runInSeparateProcess - */ - public function testClearAllTokens() - { - $storage = new Session(); - - $storage->storeAccessToken('foo', $this->getMock('\\OAuth\\Common\\Token\\TokenInterface')); - $storage->storeAccessToken('bar', $this->getMock('\\OAuth\\Common\\Token\\TokenInterface')); - - $this->assertTrue($storage->hasAccessToken('foo')); - $this->assertTrue($storage->hasAccessToken('bar')); - $this->assertInstanceOf('\\OAuth\\Common\\Storage\\Session', $storage->clearAllTokens()); - $this->assertFalse($storage->hasAccessToken('foo')); - $this->assertFalse($storage->hasAccessToken('bar')); - } - - /** - * @covers OAuth\Common\Storage\Session::__construct - * @covers OAuth\Common\Storage\Session::__destruct - * - * @runInSeparateProcess - */ - public function testDestruct() - { - $storage = new Session(); - - unset($storage); - } - - /** - * @covers OAuth\Common\Storage\Session::storeAccessToken - * @covers OAuth\Common\Storage\Session::retrieveAccessToken - * - * @runInSeparateProcess - */ - public function testSerializeUnserialize() - { - $mock = $this->getMock('\\OAuth\\Common\\Token\\AbstractToken', array('__sleep')); - $mock->expects($this->once()) - ->method('__sleep') - ->will($this->returnValue(array('accessToken'))); - - $storage = new Session(); - $storage->storeAccessToken('foo', $mock); - $retrievedToken = $storage->retrieveAccessToken('foo'); - - $this->assertInstanceOf('\\OAuth\\Common\\Token\\AbstractToken', $retrievedToken); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/Storage/StorageTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/Storage/StorageTest.php deleted file mode 100644 index 3fe1990..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/Storage/StorageTest.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @author Hannes Van De Vreken - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -namespace OAuth\Unit\Common\Storage; - -use \OAuth\OAuth2\Token\StdOAuth2Token; - -abstract class StorageTest extends \PHPUnit_Framework_TestCase -{ - protected $storage; - - /** - * Check that the token gets properly stored. - */ - public function testStorage() - { - // arrange - $service_1 = 'Facebook'; - $service_2 = 'Foursquare'; - - $token_1 = new StdOAuth2Token('access_1', 'refresh_1', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param')); - $token_2 = new StdOAuth2Token('access_2', 'refresh_2', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param')); - - // act - $this->storage->storeAccessToken($service_1, $token_1); - $this->storage->storeAccessToken($service_2, $token_2); - - // assert - $extraParams = $this->storage->retrieveAccessToken($service_1)->getExtraParams(); - $this->assertEquals('param', $extraParams['extra']); - $this->assertEquals($token_1, $this->storage->retrieveAccessToken($service_1)); - $this->assertEquals($token_2, $this->storage->retrieveAccessToken($service_2)); - } - - /** - * Test hasAccessToken. - */ - public function testHasAccessToken() - { - // arrange - $service = 'Facebook'; - $this->storage->clearToken($service); - - // act - // assert - $this->assertFalse($this->storage->hasAccessToken($service)); - } - - /** - * Check that the token gets properly deleted. - */ - public function testStorageClears() - { - // arrange - $service = 'Facebook'; - $token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param')); - - // act - $this->storage->storeAccessToken($service, $token); - $this->storage->clearToken($service); - - // assert - $this->setExpectedException('OAuth\Common\Storage\Exception\TokenNotFoundException'); - $this->storage->retrieveAccessToken($service); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/Storage/SymfonySessionTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/Storage/SymfonySessionTest.php deleted file mode 100644 index c643461..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/Storage/SymfonySessionTest.php +++ /dev/null @@ -1,111 +0,0 @@ - - * @copyright Copyright (c) 2012 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -namespace OAuth\Unit\Common\Storage; - -use OAuth\Common\Storage\SymfonySession; -use OAuth\OAuth2\Token\StdOAuth2Token; -use Symfony\Component\HttpFoundation\Session\Session; -use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; - -class SymfonySessionTest extends \PHPUnit_Framework_TestCase -{ - protected $session; - - protected $storage; - - public function setUp() - { - // set it - $this->session = new Session(new MockArraySessionStorage()); - $this->storage = new SymfonySession($this->session); - } - - public function tearDown() - { - // delete - $this->storage->getSession()->clear(); - unset($this->storage); - } - - /** - * Check that the token survives the constructor - */ - public function testStorageSurvivesConstructor() - { - $service = 'Facebook'; - $token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param')); - - // act - $this->storage->storeAccessToken($service, $token); - $this->storage = null; - $this->storage = new SymfonySession($this->session); - - // assert - $extraParams = $this->storage->retrieveAccessToken($service)->getExtraParams(); - $this->assertEquals('param', $extraParams['extra']); - $this->assertEquals($token, $this->storage->retrieveAccessToken($service)); - } - - /** - * Check that the token gets properly stored. - */ - public function testStorage() - { - // arrange - $service_1 = 'Facebook'; - $service_2 = 'Foursquare'; - - $token_1 = new StdOAuth2Token('access_1', 'refresh_1', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param')); - $token_2 = new StdOAuth2Token('access_2', 'refresh_2', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param')); - - // act - $this->storage->storeAccessToken($service_1, $token_1); - $this->storage->storeAccessToken($service_2, $token_2); - - // assert - $extraParams = $this->storage->retrieveAccessToken($service_1)->getExtraParams(); - $this->assertEquals('param', $extraParams['extra']); - $this->assertEquals($token_1, $this->storage->retrieveAccessToken($service_1)); - $this->assertEquals($token_2, $this->storage->retrieveAccessToken($service_2)); - } - - /** - * Test hasAccessToken. - */ - public function testHasAccessToken() - { - // arrange - $service = 'Facebook'; - $this->storage->clearToken($service); - - // act - // assert - $this->assertFalse($this->storage->hasAccessToken($service)); - } - - /** - * Check that the token gets properly deleted. - */ - public function testStorageClears() - { - // arrange - $service = 'Facebook'; - $token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param')); - - // act - $this->storage->storeAccessToken($service, $token); - $this->storage->clearToken($service); - - // assert - $this->setExpectedException('OAuth\Common\Storage\Exception\TokenNotFoundException'); - $this->storage->retrieveAccessToken($service); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/Common/Token/AbstractTokenTest.php b/vendor/lusitanian/oauth/tests/Unit/Common/Token/AbstractTokenTest.php deleted file mode 100644 index 54b3bb6..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/Common/Token/AbstractTokenTest.php +++ /dev/null @@ -1,189 +0,0 @@ -getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken'); - - $this->assertInstanceOf('\\OAuth\\Common\\Token\\TokenInterface', $token); - } - - /** - * @covers OAuth\Common\Token\AbstractToken::__construct - * @covers OAuth\Common\Token\AbstractToken::getAccessToken - */ - public function testGetAccessTokenNotSet() - { - $token = $this->getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken'); - - $this->assertNull($token->getAccessToken()); - } - - /** - * @covers OAuth\Common\Token\AbstractToken::__construct - * @covers OAuth\Common\Token\AbstractToken::getAccessToken - */ - public function testGetAccessTokenSet() - { - $token = $this->getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken', array('foo')); - - $this->assertSame('foo', $token->getAccessToken()); - } - - /** - * @covers OAuth\Common\Token\AbstractToken::__construct - * @covers OAuth\Common\Token\AbstractToken::getAccessToken - * @covers OAuth\Common\Token\AbstractToken::setAccessToken - */ - public function testSetAccessToken() - { - $token = $this->getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken'); - - $token->setAccessToken('foo'); - - $this->assertSame('foo', $token->getAccessToken()); - } - - /** - * @covers OAuth\Common\Token\AbstractToken::__construct - * @covers OAuth\Common\Token\AbstractToken::getRefreshToken - */ - public function testGetRefreshToken() - { - $token = $this->getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken'); - - $this->assertNull($token->getRefreshToken()); - } - - /** - * @covers OAuth\Common\Token\AbstractToken::__construct - * @covers OAuth\Common\Token\AbstractToken::getRefreshToken - */ - public function testGetRefreshTokenSet() - { - $token = $this->getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken', array('foo', 'bar')); - - $this->assertSame('bar', $token->getRefreshToken()); - } - - /** - * @covers OAuth\Common\Token\AbstractToken::__construct - * @covers OAuth\Common\Token\AbstractToken::getRefreshToken - * @covers OAuth\Common\Token\AbstractToken::setRefreshToken - */ - public function testSetRefreshToken() - { - $token = $this->getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken'); - - $token->setRefreshToken('foo'); - - $this->assertSame('foo', $token->getRefreshToken()); - } - - /** - * @covers OAuth\Common\Token\AbstractToken::__construct - * @covers OAuth\Common\Token\AbstractToken::getExtraParams - */ - public function testGetExtraParamsNotSet() - { - $token = $this->getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken'); - - $this->assertSame(array(), $token->getExtraParams()); - } - - /** - * @covers OAuth\Common\Token\AbstractToken::__construct - * @covers OAuth\Common\Token\AbstractToken::getExtraParams - */ - public function testGetExtraParamsSet() - { - $token = $this->getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken', array('foo', 'bar', null, array('foo', 'bar'))); - - $this->assertEquals(array('foo', 'bar'), $token->getExtraParams()); - } - - /** - * @covers OAuth\Common\Token\AbstractToken::__construct - * @covers OAuth\Common\Token\AbstractToken::setExtraParams - * @covers OAuth\Common\Token\AbstractToken::getExtraParams - */ - public function testSetExtraParams() - { - $token = $this->getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken'); - - $token->setExtraParams(array('foo', 'bar')); - - $this->assertSame(array('foo', 'bar'), $token->getExtraParams()); - } - - /** - * @covers OAuth\Common\Token\AbstractToken::__construct - * @covers OAuth\Common\Token\AbstractToken::setLifetime - * @covers OAuth\Common\Token\AbstractToken::getEndOfLife - */ - public function testGetEndOfLifeNotSet() - { - $token = $this->getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken'); - - $this->assertSame(AbstractToken::EOL_UNKNOWN, $token->getEndOfLife()); - } - - /** - * @covers OAuth\Common\Token\AbstractToken::__construct - * @covers OAuth\Common\Token\AbstractToken::setLifetime - * @covers OAuth\Common\Token\AbstractToken::getEndOfLife - */ - public function testGetEndOfLifeZero() - { - $token = $this->getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken', array('foo', 'bar', 0)); - - $this->assertSame(AbstractToken::EOL_NEVER_EXPIRES, $token->getEndOfLife()); - } - - /** - * @covers OAuth\Common\Token\AbstractToken::__construct - * @covers OAuth\Common\Token\AbstractToken::setLifetime - * @covers OAuth\Common\Token\AbstractToken::getEndOfLife - */ - public function testGetEndOfLifeNeverExpires() - { - $token = $this->getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken', array('foo', 'bar', AbstractToken::EOL_NEVER_EXPIRES)); - - $this->assertSame(AbstractToken::EOL_NEVER_EXPIRES, $token->getEndOfLife()); - } - - /** - * @covers OAuth\Common\Token\AbstractToken::__construct - * @covers OAuth\Common\Token\AbstractToken::setLifetime - * @covers OAuth\Common\Token\AbstractToken::getEndOfLife - */ - public function testGetEndOfLifeNeverExpiresFiveMinutes() - { - $token = $this->getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken', array('foo', 'bar', 5 * 60)); - - $this->assertSame(time() + (5*60), $token->getEndOfLife()); - } - - /** - * @covers OAuth\Common\Token\AbstractToken::__construct - * @covers OAuth\Common\Token\AbstractToken::setLifetime - * @covers OAuth\Common\Token\AbstractToken::getEndOfLife - * @covers OAuth\Common\Token\AbstractToken::setEndOfLife - */ - public function testSetEndOfLife() - { - $token = $this->getMockForAbstractClass('\\OAuth\\Common\\Token\\AbstractToken'); - - $token->setEndOfLife(10); - - $this->assertSame(10, $token->getEndOfLife()); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/AbstractServiceTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/AbstractServiceTest.php deleted file mode 100644 index 8738b08..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/AbstractServiceTest.php +++ /dev/null @@ -1,242 +0,0 @@ -getMockForAbstractClass( - '\\OAuth\\OAuth1\\Service\\AbstractService', - array( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'), - ) - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth1\Service\AbstractService::__construct - */ - public function testConstructCorrectParent() - { - $service = $this->getMockForAbstractClass( - '\\OAuth\\OAuth1\\Service\\AbstractService', - array( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'), - ) - ); - - $this->assertInstanceOf('\\OAuth\\Common\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\AbstractService::requestRequestToken - * @covers OAuth\OAuth1\Service\AbstractService::buildAuthorizationHeaderForTokenRequest - * @covers OAuth\OAuth1\Service\AbstractService::getBasicAuthorizationHeaderInfo - * @covers OAuth\OAuth1\Service\AbstractService::generateNonce - * @covers OAuth\OAuth1\Service\AbstractService::getSignatureMethod - * @covers OAuth\OAuth1\Service\AbstractService::getVersion - * @covers OAuth\OAuth1\Service\AbstractService::getExtraOAuthHeaders - * @covers OAuth\OAuth1\Service\AbstractService::parseRequestTokenResponse - */ - public function testRequestRequestTokenBuildAuthHeaderTokenRequestWithoutParams() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnCallback(function($endpoint, $array, $headers) { - \PHPUnit_Framework_Assert::assertSame('http://pieterhordijk.com/token', $endpoint->getAbsoluteUri()); - })); - - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestRequestToken()); - } - - /** - * @covers OAuth\OAuth1\Service\AbstractService::getAuthorizationUri - * @covers OAuth\OAuth1\Service\AbstractService::getAuthorizationEndpoint - */ - public function testGetAuthorizationUriWithoutParameters() - { - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertSame('http://pieterhordijk.com/auth', $service->getAuthorizationUri()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth1\Service\AbstractService::getAuthorizationUri - * @covers OAuth\OAuth1\Service\AbstractService::getAuthorizationEndpoint - */ - public function testGetAuthorizationUriWithParameters() - { - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertSame('http://pieterhordijk.com/auth?foo=bar&baz=beer', $service->getAuthorizationUri(array( - 'foo' => 'bar', - 'baz' => 'beer', - ))->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth1\Service\AbstractService::requestAccessToken - * @covers OAuth\OAuth1\Service\AbstractService::service - * @covers OAuth\OAuth1\Service\AbstractService::buildAuthorizationHeaderForAPIRequest - * @covers OAuth\OAuth1\Service\AbstractService::getBasicAuthorizationHeaderInfo - * @covers OAuth\OAuth1\Service\AbstractService::generateNonce - * @covers OAuth\OAuth1\Service\AbstractService::getSignatureMethod - * @covers OAuth\OAuth1\Service\AbstractService::getVersion - * @covers OAuth\OAuth1\Service\AbstractService::getAccessTokenEndpoint - * @covers OAuth\OAuth1\Service\AbstractService::getExtraOAuthHeaders - * @covers OAuth\OAuth1\Service\AbstractService::parseAccessTokenResponse - */ - public function testRequestAccessTokenWithoutSecret() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnCallback(function($endpoint, $array, $headers) { - \PHPUnit_Framework_Assert::assertSame('http://pieterhordijk.com/access', $endpoint->getAbsoluteUri()); - })); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - $token->expects($this->once())->method('getRequestTokenSecret')->will($this->returnValue('baz')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestAccessToken('foo', 'bar')); - } - - /** - * @covers OAuth\OAuth1\Service\AbstractService::requestAccessToken - * @covers OAuth\OAuth1\Service\AbstractService::service - * @covers OAuth\OAuth1\Service\AbstractService::buildAuthorizationHeaderForAPIRequest - * @covers OAuth\OAuth1\Service\AbstractService::getBasicAuthorizationHeaderInfo - * @covers OAuth\OAuth1\Service\AbstractService::generateNonce - * @covers OAuth\OAuth1\Service\AbstractService::getSignatureMethod - * @covers OAuth\OAuth1\Service\AbstractService::getVersion - * @covers OAuth\OAuth1\Service\AbstractService::getAccessTokenEndpoint - * @covers OAuth\OAuth1\Service\AbstractService::getExtraOAuthHeaders - * @covers OAuth\OAuth1\Service\AbstractService::parseAccessTokenResponse - */ - public function testRequestAccessTokenWithSecret() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnCallback(function($endpoint, $array, $headers) { - \PHPUnit_Framework_Assert::assertSame('http://pieterhordijk.com/access', $endpoint->getAbsoluteUri()); - })); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestAccessToken('foo', 'bar', $token)); - } - - /** - * @covers OAuth\OAuth1\Service\AbstractService::request - * @covers OAuth\OAuth1\Service\AbstractService::determineRequestUriFromPath - * @covers OAuth\OAuth1\Service\AbstractService::service - * @covers OAuth\OAuth1\Service\AbstractService::getExtraApiHeaders - * @covers OAuth\OAuth1\Service\AbstractService::buildAuthorizationHeaderForAPIRequest - * @covers OAuth\OAuth1\Service\AbstractService::getBasicAuthorizationHeaderInfo - * @covers OAuth\OAuth1\Service\AbstractService::generateNonce - * @covers OAuth\OAuth1\Service\AbstractService::getSignatureMethod - * @covers OAuth\OAuth1\Service\AbstractService::getVersion - */ - public function testRequest() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('response!')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - //$token->expects($this->once())->method('getRequestTokenSecret')->will($this->returnValue('baz')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertSame('response!', $service->request('/my/awesome/path')); - } - - /** - * This test only captures a regression in php 5.3. - * - * @covers OAuth\OAuth1\Service\AbstractService::request - */ - public function testRequestNonArrayBody() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('response!')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertSame('response!', $service->request('/my/awesome/path', 'GET', 'A text body')); - } - -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/BitBucketTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/BitBucketTest.php deleted file mode 100644 index 87be98b..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/BitBucketTest.php +++ /dev/null @@ -1,278 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth1\Service\BitBucket::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new BitBucket( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\BitBucket::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new BitBucket( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\BitBucket::__construct - * @covers OAuth\OAuth1\Service\BitBucket::getRequestTokenEndpoint - */ - public function testGetRequestTokenEndpoint() - { - $service = new BitBucket( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://bitbucket.org/!api/1.0/oauth/request_token', - $service->getRequestTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\BitBucket::__construct - * @covers OAuth\OAuth1\Service\BitBucket::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new BitBucket( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://bitbucket.org/!api/1.0/oauth/authenticate', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\BitBucket::__construct - * @covers OAuth\OAuth1\Service\BitBucket::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new BitBucket( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://bitbucket.org/!api/1.0/oauth/access_token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\BitBucket::__construct - * @covers OAuth\OAuth1\Service\BitBucket::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\BitBucket::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new BitBucket( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\BitBucket::__construct - * @covers OAuth\OAuth1\Service\BitBucket::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\BitBucket::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseNotAnArray() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('notanarray')); - - $service = new BitBucket( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\BitBucket::__construct - * @covers OAuth\OAuth1\Service\BitBucket::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\BitBucket::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotSet() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('foo=bar')); - - $service = new BitBucket( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\BitBucket::__construct - * @covers OAuth\OAuth1\Service\BitBucket::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\BitBucket::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotTrue() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=false' - )); - - $service = new BitBucket( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\BitBucket::__construct - * @covers OAuth\OAuth1\Service\BitBucket::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\BitBucket::parseRequestTokenResponse - * @covers OAuth\OAuth1\Service\BitBucket::parseAccessTokenResponse - */ - public function testParseRequestTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=true&oauth_token=foo&oauth_token_secret=bar' - )); - - $service = new BitBucket( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestRequestToken()); - } - - /** - * @covers OAuth\OAuth1\Service\BitBucket::__construct - * @covers OAuth\OAuth1\Service\BitBucket::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\BitBucket::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=bar')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new BitBucket( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo', 'bar', $token); - } - - /** - * @covers OAuth\OAuth1\Service\BitBucket::__construct - * @covers OAuth\OAuth1\Service\BitBucket::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\BitBucket::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_token=foo&oauth_token_secret=bar' - )); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new BitBucket( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestAccessToken('foo', 'bar', $token)); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/EtsyTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/EtsyTest.php deleted file mode 100644 index 97ad3cd..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/EtsyTest.php +++ /dev/null @@ -1,286 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Etsy::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Etsy( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Etsy::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Etsy( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Etsy::__construct - * @covers OAuth\OAuth1\Service\Etsy::getRequestTokenEndpoint - */ - public function testGetRequestTokenEndpoint() - { - $service = new Etsy( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://openapi.etsy.com/v2/oauth/request_token', - $service->getRequestTokenEndpoint()->getAbsoluteUri() - ); - - $service->setScopes(array('email_r', 'cart_rw')); - - $this->assertSame( - 'https://openapi.etsy.com/v2/oauth/request_token?scope=email_r%20cart_rw', - $service->getRequestTokenEndpoint()->getAbsoluteUri() - ); - - } - - /** - * @covers OAuth\OAuth1\Service\Etsy::__construct - * @covers OAuth\OAuth1\Service\Etsy::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Etsy( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://openapi.etsy.com/v2/', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Etsy::__construct - * @covers OAuth\OAuth1\Service\Etsy::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Etsy( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://openapi.etsy.com/v2/oauth/access_token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Etsy::__construct - * @covers OAuth\OAuth1\Service\Etsy::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Etsy::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Etsy( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Etsy::__construct - * @covers OAuth\OAuth1\Service\Etsy::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Etsy::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseNotAnArray() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('notanarray')); - - $service = new Etsy( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Etsy::__construct - * @covers OAuth\OAuth1\Service\Etsy::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Etsy::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotSet() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('foo=bar')); - - $service = new Etsy( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Etsy::__construct - * @covers OAuth\OAuth1\Service\Etsy::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Etsy::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotTrue() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=false' - )); - - $service = new Etsy( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Etsy::__construct - * @covers OAuth\OAuth1\Service\Etsy::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Etsy::parseRequestTokenResponse - * @covers OAuth\OAuth1\Service\Etsy::parseAccessTokenResponse - */ - public function testParseRequestTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=true&oauth_token=foo&oauth_token_secret=bar' - )); - - $service = new Etsy( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestRequestToken()); - } - - /** - * @covers OAuth\OAuth1\Service\Etsy::__construct - * @covers OAuth\OAuth1\Service\Etsy::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Etsy::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=bar')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Etsy( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo', 'bar', $token); - } - - /** - * @covers OAuth\OAuth1\Service\Etsy::__construct - * @covers OAuth\OAuth1\Service\Etsy::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Etsy::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_token=foo&oauth_token_secret=bar' - )); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Etsy( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestAccessToken('foo', 'bar', $token)); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/FitBitTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/FitBitTest.php deleted file mode 100644 index a8b7ae2..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/FitBitTest.php +++ /dev/null @@ -1,278 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth1\Service\FitBit::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new FitBit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\FitBit::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new FitBit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\FitBit::__construct - * @covers OAuth\OAuth1\Service\FitBit::getRequestTokenEndpoint - */ - public function testGetRequestTokenEndpoint() - { - $service = new FitBit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://api.fitbit.com/oauth/request_token', - $service->getRequestTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\FitBit::__construct - * @covers OAuth\OAuth1\Service\FitBit::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new FitBit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://www.fitbit.com/oauth/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\FitBit::__construct - * @covers OAuth\OAuth1\Service\FitBit::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new FitBit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://api.fitbit.com/oauth/access_token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\FitBit::__construct - * @covers OAuth\OAuth1\Service\FitBit::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\FitBit::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new FitBit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\FitBit::__construct - * @covers OAuth\OAuth1\Service\FitBit::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\FitBit::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseNotAnArray() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('notanarray')); - - $service = new FitBit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\FitBit::__construct - * @covers OAuth\OAuth1\Service\FitBit::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\FitBit::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotSet() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('foo=bar')); - - $service = new FitBit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\FitBit::__construct - * @covers OAuth\OAuth1\Service\FitBit::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\FitBit::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotTrue() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=false' - )); - - $service = new FitBit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\FitBit::__construct - * @covers OAuth\OAuth1\Service\FitBit::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\FitBit::parseRequestTokenResponse - * @covers OAuth\OAuth1\Service\FitBit::parseAccessTokenResponse - */ - public function testParseRequestTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=true&oauth_token=foo&oauth_token_secret=bar' - )); - - $service = new FitBit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestRequestToken()); - } - - /** - * @covers OAuth\OAuth1\Service\FitBit::__construct - * @covers OAuth\OAuth1\Service\FitBit::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\FitBit::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=bar')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new FitBit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo', 'bar', $token); - } - - /** - * @covers OAuth\OAuth1\Service\FitBit::__construct - * @covers OAuth\OAuth1\Service\FitBit::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\FitBit::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_token=foo&oauth_token_secret=bar' - )); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new FitBit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestAccessToken('foo', 'bar', $token)); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/FiveHundredPx.php b/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/FiveHundredPx.php deleted file mode 100644 index 1912a05..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/FiveHundredPx.php +++ /dev/null @@ -1,278 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth1\Service\FiveHundredPx::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new FiveHundredPx( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\FiveHundredPx::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new FiveHundredPx( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\FiveHundredPx::__construct - * @covers OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint - */ - public function testGetRequestTokenEndpoint() - { - $service = new FiveHundredPx( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://api.500px.com/v1/oauth/request_token', - $service->getRequestTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\FiveHundredPx::__construct - * @covers OAuth\OAuth1\Service\FiveHundredPx::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new FiveHundredPx( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://api.500px.com/v1/oauth/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\FiveHundredPx::__construct - * @covers OAuth\OAuth1\Service\FiveHundredPx::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new FiveHundredPx( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://api.500px.com/v1/oauth/access_token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\FiveHundredPx::__construct - * @covers OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\FiveHundredPx::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new FiveHundredPx( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\FiveHundredPx::__construct - * @covers OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\FiveHundredPx::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseNotAnArray() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('notanarray')); - - $service = new FiveHundredPx( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\FiveHundredPx::__construct - * @covers OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\FiveHundredPx::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotSet() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('foo=bar')); - - $service = new FiveHundredPx( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\FiveHundredPx::__construct - * @covers OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\FiveHundredPx::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotTrue() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=false' - )); - - $service = new FiveHundredPx( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\FiveHundredPx::__construct - * @covers OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\FiveHundredPx::parseRequestTokenResponse - * @covers OAuth\OAuth1\Service\FiveHundredPx::parseAccessTokenResponse - */ - public function testParseRequestTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=true&oauth_token=foo&oauth_token_secret=bar' - )); - - $service = new FiveHundredPx( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestRequestToken()); - } - - /** - * @covers OAuth\OAuth1\Service\FiveHundredPx::__construct - * @covers OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\FiveHundredPx::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=bar')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new FiveHundredPx( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo', 'bar', $token); - } - - /** - * @covers OAuth\OAuth1\Service\FiveHundredPx::__construct - * @covers OAuth\OAuth1\Service\FiveHundredPx::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\FiveHundredPx::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_token=foo&oauth_token_secret=bar' - )); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new FiveHundredPx( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestAccessToken('foo', 'bar', $token)); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/FlickrTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/FlickrTest.php deleted file mode 100644 index ee88f71..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/FlickrTest.php +++ /dev/null @@ -1,302 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Flickr::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Flickr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Flickr::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Flickr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Flickr::__construct - * @covers OAuth\OAuth1\Service\Flickr::getRequestTokenEndpoint - */ - public function testGetRequestTokenEndpoint() - { - $service = new Flickr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://www.flickr.com/services/oauth/request_token', - $service->getRequestTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Flickr::__construct - * @covers OAuth\OAuth1\Service\Flickr::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Flickr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://www.flickr.com/services/oauth/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Flickr::__construct - * @covers OAuth\OAuth1\Service\Flickr::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Flickr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://www.flickr.com/services/oauth/access_token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Flickr::__construct - * @covers OAuth\OAuth1\Service\Flickr::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Flickr::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Flickr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Flickr::__construct - * @covers OAuth\OAuth1\Service\Flickr::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Flickr::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseNotAnArray() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('notanarray')); - - $service = new Flickr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Flickr::__construct - * @covers OAuth\OAuth1\Service\Flickr::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Flickr::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotSet() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('foo=bar')); - - $service = new Flickr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Flickr::__construct - * @covers OAuth\OAuth1\Service\Flickr::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Flickr::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotTrue() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=false' - )); - - $service = new Flickr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Flickr::__construct - * @covers OAuth\OAuth1\Service\Flickr::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Flickr::parseRequestTokenResponse - * @covers OAuth\OAuth1\Service\Flickr::parseAccessTokenResponse - */ - public function testParseRequestTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=true&oauth_token=foo&oauth_token_secret=bar' - )); - - $service = new Flickr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestRequestToken()); - } - - /** - * @covers OAuth\OAuth1\Service\Flickr::__construct - * @covers OAuth\OAuth1\Service\Flickr::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Flickr::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=bar')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Flickr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo', 'bar', $token); - } - - /** - * @covers OAuth\OAuth1\Service\Flickr::__construct - * @covers OAuth\OAuth1\Service\Flickr::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Flickr::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_token=foo&oauth_token_secret=bar' - )); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Flickr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestAccessToken('foo', 'bar', $token)); - } - - /** - * @covers OAuth\OAuth1\Service\Flickr::request - */ - public function testRequest() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('response!')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Flickr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertSame('response!', $service->request('/my/awesome/path')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/QuickBooksTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/QuickBooksTest.php deleted file mode 100644 index 2af9581..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/QuickBooksTest.php +++ /dev/null @@ -1,212 +0,0 @@ -getQuickBooks(); - $this->assertInstanceOf( - '\\OAuth\\OAuth1\\Service\\ServiceInterface', - $service - ); - } - - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = $this->getQuickBooks(); - $this->assertInstanceOf( - '\\OAuth\\OAuth1\\Service\\AbstractService', - $service - ); - } - - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new QuickBooks( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf( - '\\OAuth\\OAuth1\\Service\\AbstractService', - $service - ); - } - - public function testGetRequestTokenEndpoint() - { - $service = $this->getQuickBooks(); - $this->assertSame( - 'https://oauth.intuit.com/oauth/v1/get_request_token', - $service->getRequestTokenEndpoint()->getAbsoluteUri() - ); - } - - public function testGetAuthorizationEndpoint() - { - $service = $this->getQuickBooks(); - $this->assertSame( - 'https://appcenter.intuit.com/Connect/Begin', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - public function testGetAccessTokenEndpoint() - { - $service = $this->getQuickBooks(); - $this->assertSame( - 'https://oauth.intuit.com/oauth/v1/get_access_token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @expectedException \OAuth\Common\Http\Exception\TokenResponseException - * @expectedExceptionMessage Error in retrieving token. - */ - public function testParseRequestTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getClientInterfaceMockThatReturns(null); - $service = $this->getQuickBooks($client); - $service->requestRequestToken(); - } - - /** - * @expectedException \OAuth\Common\Http\Exception\TokenResponseException - * @expectedExceptionMessage Error in retrieving token. - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseNotAnArray() - { - $client = $this->getClientInterfaceMockThatReturns('notanarray'); - $service = $this->getQuickBooks($client); - $service->requestRequestToken(); - } - - /** - * @expectedException \OAuth\Common\Http\Exception\TokenResponseException - * @expectedExceptionMessage Error in retrieving token. - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotSet() - { - $client = $this->getClientInterfaceMockThatReturns('foo=bar'); - $service = $this->getQuickBooks($client); - $service->requestRequestToken(); - } - - /** - * @expectedException \OAuth\Common\Http\Exception\TokenResponseException - * @expectedExceptionMessage Error in retrieving token. - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotTrue() - { - $client = $this->getClientInterfaceMockThatReturns( - 'oauth_callback_confirmed=false' - ); - $service = $this->getQuickBooks($client); - $service->requestRequestToken(); - } - - public function testParseRequestTokenResponseValid() - { - $client = $this->getClientInterfaceMockThatReturns( - 'oauth_callback_confirmed=true&oauth_token=foo&oauth_token_secret=bar' - ); - $service = $this->getQuickBooks($client); - $this->assertInstanceOf( - '\\OAuth\\OAuth1\\Token\\StdOAuth1Token', - $service->requestRequestToken() - ); - } - - /** - * @expectedException \OAuth\Common\Http\Exception\TokenResponseException - * @expectedExceptionMessage Error in retrieving token: "bar" - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - $service = $this->getQuickBooksForRequestingAccessToken( - $token, - 'error=bar' - ); - - $service->requestAccessToken('foo', 'bar', $token); - } - - public function testParseAccessTokenResponseValid() - { - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - $service = $this->getQuickBooksForRequestingAccessToken( - $token, - 'oauth_token=foo&oauth_token_secret=bar' - ); - - $this->assertInstanceOf( - '\\OAuth\\OAuth1\\Token\\StdOAuth1Token', - $service->requestAccessToken('foo', 'bar', $token) - ); - } - - protected function getQuickBooks( - ClientInterface $client = null, - TokenStorageInterface $storage = null - ) - { - if (!$client) { - $client = $this->getMock( - '\\OAuth\\Common\\Http\\Client\\ClientInterface' - ); - } - - if (!$storage) { - $storage = $this->getMock( - '\\OAuth\\Common\\Storage\\TokenStorageInterface' - ); - } - - return new QuickBooks( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - } - - protected function getQuickBooksForRequestingAccessToken( - TokenInterface $token, - $response - ) - { - $client = $this->getClientInterfaceMockThatReturns($response); - $storage = $this->getMock( - '\\OAuth\\Common\\Storage\\TokenStorageInterface' - ); - $storage->expects($this->any()) - ->method('retrieveAccessToken') - ->will($this->returnValue($token)); - - return $this->getQuickBooks($client, $storage); - } - - protected function getClientInterfaceMockThatReturns($returnValue) - { - $client = $this->getMock( - '\\OAuth\\Common\\Http\\Client\\ClientInterface' - ); - $client->expects($this->once()) - ->method('retrieveResponse') - ->will($this->returnValue($returnValue)); - - return $client; - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/ScoopItTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/ScoopItTest.php deleted file mode 100644 index 4ba83fa..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/ScoopItTest.php +++ /dev/null @@ -1,302 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth1\Service\ScoopIt::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new ScoopIt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\ScoopIt::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new ScoopIt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\ScoopIt::__construct - * @covers OAuth\OAuth1\Service\ScoopIt::getRequestTokenEndpoint - */ - public function testGetRequestTokenEndpoint() - { - $service = new ScoopIt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://www.scoop.it/oauth/request', - $service->getRequestTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\ScoopIt::__construct - * @covers OAuth\OAuth1\Service\ScoopIt::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new ScoopIt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://www.scoop.it/oauth/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\ScoopIt::__construct - * @covers OAuth\OAuth1\Service\ScoopIt::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new ScoopIt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://www.scoop.it/oauth/access', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\ScoopIt::__construct - * @covers OAuth\OAuth1\Service\ScoopIt::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\ScoopIt::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new ScoopIt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\ScoopIt::__construct - * @covers OAuth\OAuth1\Service\ScoopIt::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\ScoopIt::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseNotAnArray() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('notanarray')); - - $service = new ScoopIt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\ScoopIt::__construct - * @covers OAuth\OAuth1\Service\ScoopIt::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\ScoopIt::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotSet() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('foo=bar')); - - $service = new ScoopIt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\ScoopIt::__construct - * @covers OAuth\OAuth1\Service\ScoopIt::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\ScoopIt::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotTrue() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=false' - )); - - $service = new ScoopIt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\ScoopIt::__construct - * @covers OAuth\OAuth1\Service\ScoopIt::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\ScoopIt::parseRequestTokenResponse - * @covers OAuth\OAuth1\Service\ScoopIt::parseAccessTokenResponse - */ - public function testParseRequestTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=true&oauth_token=foo&oauth_token_secret=bar' - )); - - $service = new ScoopIt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestRequestToken()); - } - - /** - * @covers OAuth\OAuth1\Service\ScoopIt::__construct - * @covers OAuth\OAuth1\Service\ScoopIt::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\ScoopIt::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=bar')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new ScoopIt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo', 'bar', $token); - } - - /** - * @covers OAuth\OAuth1\Service\ScoopIt::__construct - * @covers OAuth\OAuth1\Service\ScoopIt::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\ScoopIt::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_token=foo&oauth_token_secret=bar' - )); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new ScoopIt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestAccessToken('foo', 'bar', $token)); - } - - /** - * @covers OAuth\OAuth1\Service\ScoopIt::request - */ - public function testRequest() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('response!')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new ScoopIt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertSame('response!', $service->request('/my/awesome/path')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/TumblrTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/TumblrTest.php deleted file mode 100644 index f1467ad..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/TumblrTest.php +++ /dev/null @@ -1,278 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Tumblr::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Tumblr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Tumblr::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Tumblr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Tumblr::__construct - * @covers OAuth\OAuth1\Service\Tumblr::getRequestTokenEndpoint - */ - public function testGetRequestTokenEndpoint() - { - $service = new Tumblr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://www.tumblr.com/oauth/request_token', - $service->getRequestTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Tumblr::__construct - * @covers OAuth\OAuth1\Service\Tumblr::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Tumblr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://www.tumblr.com/oauth/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Tumblr::__construct - * @covers OAuth\OAuth1\Service\Tumblr::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Tumblr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://www.tumblr.com/oauth/access_token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Tumblr::__construct - * @covers OAuth\OAuth1\Service\Tumblr::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Tumblr::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Tumblr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Tumblr::__construct - * @covers OAuth\OAuth1\Service\Tumblr::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Tumblr::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseNotAnArray() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('notanarray')); - - $service = new Tumblr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Tumblr::__construct - * @covers OAuth\OAuth1\Service\Tumblr::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Tumblr::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotSet() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('foo=bar')); - - $service = new Tumblr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Tumblr::__construct - * @covers OAuth\OAuth1\Service\Tumblr::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Tumblr::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotTrue() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=false' - )); - - $service = new Tumblr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Tumblr::__construct - * @covers OAuth\OAuth1\Service\Tumblr::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Tumblr::parseRequestTokenResponse - * @covers OAuth\OAuth1\Service\Tumblr::parseAccessTokenResponse - */ - public function testParseRequestTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=true&oauth_token=foo&oauth_token_secret=bar' - )); - - $service = new Tumblr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestRequestToken()); - } - - /** - * @covers OAuth\OAuth1\Service\Tumblr::__construct - * @covers OAuth\OAuth1\Service\Tumblr::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Tumblr::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=bar')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Tumblr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo', 'bar', $token); - } - - /** - * @covers OAuth\OAuth1\Service\Tumblr::__construct - * @covers OAuth\OAuth1\Service\Tumblr::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Tumblr::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_token=foo&oauth_token_secret=bar' - )); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Tumblr( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestAccessToken('foo', 'bar', $token)); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/TwitterTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/TwitterTest.php deleted file mode 100644 index aeead0c..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/TwitterTest.php +++ /dev/null @@ -1,383 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::__construct - * @covers OAuth\OAuth1\Service\Twitter::getRequestTokenEndpoint - */ - public function testGetRequestTokenEndpoint() - { - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://api.twitter.com/oauth/request_token', - $service->getRequestTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::__construct - * @covers OAuth\OAuth1\Service\Twitter::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertTrue( - in_array( - strtolower($service->getAuthorizationEndpoint()->getAbsoluteUri()), - array(\OAuth\OAuth1\Service\Twitter::ENDPOINT_AUTHENTICATE, \OAuth\OAuth1\Service\Twitter::ENDPOINT_AUTHORIZE) - ) - ); - - $service->setAuthorizationEndpoint( \OAuth\OAuth1\Service\Twitter::ENDPOINT_AUTHORIZE ); - - $this->assertTrue( - in_array( - strtolower($service->getAuthorizationEndpoint()->getAbsoluteUri()), - array(\OAuth\OAuth1\Service\Twitter::ENDPOINT_AUTHENTICATE, \OAuth\OAuth1\Service\Twitter::ENDPOINT_AUTHORIZE) - ) - ); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::__construct - * @covers OAuth\OAuth1\Service\Twitter::setAuthorizationEndpoint - */ - public function testSetAuthorizationEndpoint() - { - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Exception\\Exception'); - - $service->setAuthorizationEndpoint('foo'); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::__construct - * @covers OAuth\OAuth1\Service\Twitter::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://api.twitter.com/oauth/access_token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::__construct - * @covers OAuth\OAuth1\Service\Twitter::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Twitter::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::__construct - * @covers OAuth\OAuth1\Service\Twitter::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Twitter::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseNotAnArray() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('notanarray')); - - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::__construct - * @covers OAuth\OAuth1\Service\Twitter::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Twitter::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotSet() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('foo=bar')); - - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::__construct - * @covers OAuth\OAuth1\Service\Twitter::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Twitter::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotTrue() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=false' - )); - - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::__construct - * @covers OAuth\OAuth1\Service\Twitter::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Twitter::parseRequestTokenResponse - * @covers OAuth\OAuth1\Service\Twitter::parseAccessTokenResponse - */ - public function testParseRequestTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=true&oauth_token=foo&oauth_token_secret=bar' - )); - - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestRequestToken()); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::__construct - * @covers OAuth\OAuth1\Service\Twitter::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Twitter::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=bar')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo', 'bar', $token); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::__construct - * @covers OAuth\OAuth1\Service\Twitter::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Twitter::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_token=foo&oauth_token_secret=bar' - )); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestAccessToken('foo', 'bar', $token)); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::parseAccessTokenResponse - */ - public function testParseAccessTokenErrorTotalBullshit() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - $method = new \ReflectionMethod(get_class($service), 'parseAccessTokenResponse'); - $method->setAccessible(true); - $method->invokeArgs($service, array("hoho")); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::parseAccessTokenResponse - */ - public function testParseAccessTokenErrorItsAnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - $method = new \ReflectionMethod(get_class($service), 'parseAccessTokenResponse'); - $method->setAccessible(true); - $method->invokeArgs($service, array("error=hihihaha")); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::parseAccessTokenResponse - */ - public function testParseAccessTokenErrorItsMissingOauthToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - $method = new \ReflectionMethod(get_class($service), 'parseAccessTokenResponse'); - $method->setAccessible(true); - $method->invokeArgs($service, array("oauth_token_secret=1")); - } - - /** - * @covers OAuth\OAuth1\Service\Twitter::parseAccessTokenResponse - */ - public function testParseAccessTokenErrorItsMissingOauthTokenSecret() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $service = new Twitter( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - $method = new \ReflectionMethod(get_class($service), 'parseAccessTokenResponse'); - $method->setAccessible(true); - $method->invokeArgs($service, array("oauth_token=1")); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/XingTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/XingTest.php deleted file mode 100644 index 4708b7b..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/XingTest.php +++ /dev/null @@ -1,239 +0,0 @@ -client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $this->storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - - $this->xing = new Xing( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->client, - $this->storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - } - - /** - * @covers OAuth\OAuth1\Service\Xing::__construct - */ - public function testConstructCorrectInterfaceWithoutCustomUri() - { - $this->assertInstanceOf( - '\\OAuth\\OAuth1\\Service\\ServiceInterface', $this->xing - ); - } - - /** - * @covers OAuth\OAuth1\Service\Xing::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $this->assertInstanceOf( - '\\OAuth\\OAuth1\\Service\\AbstractService', $this->xing - ); - } - - /** - * @covers OAuth\OAuth1\Service\Xing::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Xing( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->client, - $this->storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Xing::__construct - * @covers OAuth\OAuth1\Service\Xing::getRequestTokenEndpoint - */ - public function testGetRequestTokenEndpoint() - { - $this->assertSame( - 'https://api.xing.com/v1/request_token', - $this->xing->getRequestTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Xing::__construct - * @covers OAuth\OAuth1\Service\Xing::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $this->assertSame( - 'https://api.xing.com/v1/authorize', - $this->xing->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Xing::__construct - * @covers OAuth\OAuth1\Service\Xing::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $this->assertSame( - 'https://api.xing.com/v1/access_token', - $this->xing->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Xing::__construct - * @covers OAuth\OAuth1\Service\Xing::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Xing::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnNulledResponse() - { - $this->client - ->expects($this->once()) - ->method('retrieveResponse') - ->will($this->returnValue(null)); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $this->xing->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Xing::__construct - * @covers OAuth\OAuth1\Service\Xing::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Xing::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseNotAnArray() - { - $this->client - ->expects($this->once()) - ->method('retrieveResponse') - ->will($this->returnValue('notanarray')); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $this->xing->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Xing::__construct - * @covers OAuth\OAuth1\Service\Xing::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Xing::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotSet() - { - $this->client - ->expects($this->once()) - ->method('retrieveResponse') - ->will($this->returnValue('foo=bar')); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $this->xing->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Xing::__construct - * @covers OAuth\OAuth1\Service\Xing::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Xing::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotTrue() - { - $this->client - ->expects($this->once()) - ->method('retrieveResponse') - ->will($this->returnValue('oauth_callback_confirmed=false')); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $this->xing->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Xing::__construct - * @covers OAuth\OAuth1\Service\Xing::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Xing::parseRequestTokenResponse - * @covers OAuth\OAuth1\Service\Xing::parseAccessTokenResponse - */ - public function testParseRequestTokenResponseValid() - { - $this->client - ->expects($this->once()) - ->method('retrieveResponse') - ->will($this->returnValue( - 'oauth_callback_confirmed=true&oauth_token=foo&oauth_token_secret=bar' - )); - - $this->assertInstanceOf( - '\\OAuth\\OAuth1\\Token\\StdOAuth1Token', - $this->xing->requestRequestToken() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Xing::__construct - * @covers OAuth\OAuth1\Service\Xing::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Xing::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $this->client - ->expects($this->once()) - ->method('retrieveResponse') - ->will($this->returnValue('{"message":"Invalid OAuth signature","error_name":"INVALID_OAUTH_SIGNATURE"}')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $this->storage - ->expects($this->any()) - ->method('retrieveAccessToken') - ->will($this->returnValue($token)); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $this->xing->requestAccessToken('foo', 'bar', $token); - } - - /** - * @covers OAuth\OAuth1\Service\Xing::__construct - * @covers OAuth\OAuth1\Service\Xing::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Xing::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValid() - { - $this->client - ->expects($this->once()) - ->method('retrieveResponse') - ->will($this->returnValue('oauth_token=foo&oauth_token_secret=bar')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $this->storage - ->expects($this->any()) - ->method('retrieveAccessToken') - ->will($this->returnValue($token)); - - - $this->assertInstanceOf( - '\\OAuth\\OAuth1\\Token\\StdOAuth1Token', - $this->xing->requestAccessToken('foo', 'bar', $token) - ); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/YahooTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/YahooTest.php deleted file mode 100644 index e8feb5d..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Service/YahooTest.php +++ /dev/null @@ -1,302 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Yahoo::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Yahoo::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth1\Service\Yahoo::__construct - * @covers OAuth\OAuth1\Service\Yahoo::getRequestTokenEndpoint - */ - public function testGetRequestTokenEndpoint() - { - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://api.login.yahoo.com/oauth/v2/get_request_token', - $service->getRequestTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Yahoo::__construct - * @covers OAuth\OAuth1\Service\Yahoo::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://api.login.yahoo.com/oauth/v2/request_auth', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Yahoo::__construct - * @covers OAuth\OAuth1\Service\Yahoo::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertSame( - 'https://api.login.yahoo.com/oauth/v2/get_token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth1\Service\Yahoo::__construct - * @covers OAuth\OAuth1\Service\Yahoo::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Yahoo::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Yahoo::__construct - * @covers OAuth\OAuth1\Service\Yahoo::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Yahoo::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseNotAnArray() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('notanarray')); - - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Yahoo::__construct - * @covers OAuth\OAuth1\Service\Yahoo::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Yahoo::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotSet() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('foo=bar')); - - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Yahoo::__construct - * @covers OAuth\OAuth1\Service\Yahoo::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Yahoo::parseRequestTokenResponse - */ - public function testParseRequestTokenResponseThrowsExceptionOnResponseCallbackNotTrue() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=false' - )); - - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestRequestToken(); - } - - /** - * @covers OAuth\OAuth1\Service\Yahoo::__construct - * @covers OAuth\OAuth1\Service\Yahoo::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Yahoo::parseRequestTokenResponse - * @covers OAuth\OAuth1\Service\Yahoo::parseAccessTokenResponse - */ - public function testParseRequestTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_callback_confirmed=true&oauth_token=foo&oauth_token_secret=bar' - )); - - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestRequestToken()); - } - - /** - * @covers OAuth\OAuth1\Service\Yahoo::__construct - * @covers OAuth\OAuth1\Service\Yahoo::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Yahoo::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=bar')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo', 'bar', $token); - } - - /** - * @covers OAuth\OAuth1\Service\Yahoo::__construct - * @covers OAuth\OAuth1\Service\Yahoo::getRequestTokenEndpoint - * @covers OAuth\OAuth1\Service\Yahoo::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue( - 'oauth_token=foo&oauth_token_secret=bar' - )); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Token\\StdOAuth1Token', $service->requestAccessToken('foo', 'bar', $token)); - } - - /** - * @covers OAuth\OAuth1\Service\Yahoo::request - */ - public function testRequest() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('response!')); - - $token = $this->getMock('\\OAuth\\OAuth1\\Token\\TokenInterface'); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->any())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - $this->getMock('\\OAuth\\OAuth1\\Signature\\SignatureInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertSame('response!', $service->request('/my/awesome/path')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Signature/SignatureTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth1/Signature/SignatureTest.php deleted file mode 100644 index 44c731f..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Signature/SignatureTest.php +++ /dev/null @@ -1,325 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface')); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Signature\\SignatureInterface', $signature); - } - - /** - * @covers OAuth\OAuth1\Signature\Signature::__construct - * @covers OAuth\OAuth1\Signature\Signature::setHashingAlgorithm - */ - public function testSetHashingAlgorithm() - { - $signature = new Signature($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface')); - - $this->assertNull($signature->setHashingAlgorithm('foo')); - } - - /** - * @covers OAuth\OAuth1\Signature\Signature::__construct - * @covers OAuth\OAuth1\Signature\Signature::setTokenSecret - */ - public function testSetTokenSecret() - { - $signature = new Signature($this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface')); - - $this->assertNull($signature->setTokenSecret('foo')); - } - - /** - * @covers OAuth\OAuth1\Signature\Signature::__construct - * @covers OAuth\OAuth1\Signature\Signature::setHashingAlgorithm - * @covers OAuth\OAuth1\Signature\Signature::setTokenSecret - * @covers OAuth\OAuth1\Signature\Signature::getSignature - * @covers OAuth\OAuth1\Signature\Signature::buildSignatureDataString - * @covers OAuth\OAuth1\Signature\Signature::hash - * @covers OAuth\OAuth1\Signature\Signature::getSigningKey - */ - public function testGetSignatureBareUri() - { - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->any()) - ->method('getConsumerSecret') - ->will($this->returnValue('foo')); - - - $signature = new Signature($credentials); - - $signature->setHashingAlgorithm('HMAC-SHA1'); - $signature->setTokenSecret('foo'); - - $uri = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $uri->expects($this->any()) - ->method('getQuery') - ->will($this->returnValue('')); - $uri->expects($this->any()) - ->method('getScheme') - ->will($this->returnValue('http')); - $uri->expects($this->any()) - ->method('getRawAuthority') - ->will($this->returnValue('')); - $uri->expects($this->any()) - ->method('getPath') - ->will($this->returnValue('/foo')); - - $this->assertSame('uoCpiII/Lg/cPiF0XrU2pj4eGFQ=', $signature->getSignature($uri, array('pee' => 'haa'))); - } - - /** - * @covers OAuth\OAuth1\Signature\Signature::__construct - * @covers OAuth\OAuth1\Signature\Signature::setHashingAlgorithm - * @covers OAuth\OAuth1\Signature\Signature::setTokenSecret - * @covers OAuth\OAuth1\Signature\Signature::getSignature - * @covers OAuth\OAuth1\Signature\Signature::buildSignatureDataString - * @covers OAuth\OAuth1\Signature\Signature::hash - * @covers OAuth\OAuth1\Signature\Signature::getSigningKey - */ - public function testGetSignatureWithQueryString() - { - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->any()) - ->method('getConsumerSecret') - ->will($this->returnValue('foo')); - - - $signature = new Signature($credentials); - - $signature->setHashingAlgorithm('HMAC-SHA1'); - $signature->setTokenSecret('foo'); - - $uri = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $uri->expects($this->any()) - ->method('getQuery') - ->will($this->returnValue('param1=value1')); - $uri->expects($this->any()) - ->method('getScheme') - ->will($this->returnValue('http')); - $uri->expects($this->any()) - ->method('getRawAuthority') - ->will($this->returnValue('')); - $uri->expects($this->any()) - ->method('getPath') - ->will($this->returnValue('/foo')); - - $this->assertSame('LxtD+WjJBRppIUvEI79iQ7I0hSo=', $signature->getSignature($uri, array('pee' => 'haa'))); - } - - /** - * @covers OAuth\OAuth1\Signature\Signature::__construct - * @covers OAuth\OAuth1\Signature\Signature::setHashingAlgorithm - * @covers OAuth\OAuth1\Signature\Signature::setTokenSecret - * @covers OAuth\OAuth1\Signature\Signature::getSignature - * @covers OAuth\OAuth1\Signature\Signature::buildSignatureDataString - * @covers OAuth\OAuth1\Signature\Signature::hash - * @covers OAuth\OAuth1\Signature\Signature::getSigningKey - */ - public function testGetSignatureWithAuthority() - { - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->any()) - ->method('getConsumerSecret') - ->will($this->returnValue('foo')); - - - $signature = new Signature($credentials); - - $signature->setHashingAlgorithm('HMAC-SHA1'); - $signature->setTokenSecret('foo'); - - $uri = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $uri->expects($this->any()) - ->method('getQuery') - ->will($this->returnValue('param1=value1')); - $uri->expects($this->any()) - ->method('getScheme') - ->will($this->returnValue('http')); - $uri->expects($this->any()) - ->method('getRawAuthority') - ->will($this->returnValue('peehaa:pass')); - $uri->expects($this->any()) - ->method('getPath') - ->will($this->returnValue('/foo')); - - $this->assertSame('MHvkRndIntLrxiPkjkiCNsMEqv4=', $signature->getSignature($uri, array('pee' => 'haa'))); - } - - /** - * @covers OAuth\OAuth1\Signature\Signature::__construct - * @covers OAuth\OAuth1\Signature\Signature::setHashingAlgorithm - * @covers OAuth\OAuth1\Signature\Signature::setTokenSecret - * @covers OAuth\OAuth1\Signature\Signature::getSignature - * @covers OAuth\OAuth1\Signature\Signature::buildSignatureDataString - * @covers OAuth\OAuth1\Signature\Signature::hash - * @covers OAuth\OAuth1\Signature\Signature::getSigningKey - */ - public function testGetSignatureWithBarePathNonExplicitTrailingHostSlash() - { - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->any()) - ->method('getConsumerSecret') - ->will($this->returnValue('foo')); - - - $signature = new Signature($credentials); - - $signature->setHashingAlgorithm('HMAC-SHA1'); - $signature->setTokenSecret('foo'); - - $uri = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $uri->expects($this->any()) - ->method('getQuery') - ->will($this->returnValue('param1=value1')); - $uri->expects($this->any()) - ->method('getScheme') - ->will($this->returnValue('http')); - $uri->expects($this->any()) - ->method('getRawAuthority') - ->will($this->returnValue('peehaa:pass')); - $uri->expects($this->any()) - ->method('getPath') - ->will($this->returnValue('/')); - $uri->expects($this->any()) - ->method('hasExplicitTrailingHostSlash') - ->will($this->returnValue(false)); - - $this->assertSame('iFELDoiI5Oj9ixB3kHzoPvBpq0w=', $signature->getSignature($uri, array('pee' => 'haa'))); - } - - /** - * @covers OAuth\OAuth1\Signature\Signature::__construct - * @covers OAuth\OAuth1\Signature\Signature::setHashingAlgorithm - * @covers OAuth\OAuth1\Signature\Signature::setTokenSecret - * @covers OAuth\OAuth1\Signature\Signature::getSignature - * @covers OAuth\OAuth1\Signature\Signature::buildSignatureDataString - * @covers OAuth\OAuth1\Signature\Signature::hash - * @covers OAuth\OAuth1\Signature\Signature::getSigningKey - */ - public function testGetSignatureWithBarePathWithExplicitTrailingHostSlash() - { - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->any()) - ->method('getConsumerSecret') - ->will($this->returnValue('foo')); - - - $signature = new Signature($credentials); - - $signature->setHashingAlgorithm('HMAC-SHA1'); - $signature->setTokenSecret('foo'); - - $uri = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $uri->expects($this->any()) - ->method('getQuery') - ->will($this->returnValue('param1=value1')); - $uri->expects($this->any()) - ->method('getScheme') - ->will($this->returnValue('http')); - $uri->expects($this->any()) - ->method('getRawAuthority') - ->will($this->returnValue('peehaa:pass')); - $uri->expects($this->any()) - ->method('getPath') - ->will($this->returnValue('/')); - $uri->expects($this->any()) - ->method('hasExplicitTrailingHostSlash') - ->will($this->returnValue(true)); - - $this->assertSame('IEhUsArSTLvbQ3QYr0zzn+Rxpjg=', $signature->getSignature($uri, array('pee' => 'haa'))); - } - - /** - * @covers OAuth\OAuth1\Signature\Signature::__construct - * @covers OAuth\OAuth1\Signature\Signature::setHashingAlgorithm - * @covers OAuth\OAuth1\Signature\Signature::setTokenSecret - * @covers OAuth\OAuth1\Signature\Signature::getSignature - * @covers OAuth\OAuth1\Signature\Signature::buildSignatureDataString - * @covers OAuth\OAuth1\Signature\Signature::hash - * @covers OAuth\OAuth1\Signature\Signature::getSigningKey - */ - public function testGetSignatureNoTokenSecretSet() - { - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->any()) - ->method('getConsumerSecret') - ->will($this->returnValue('foo')); - - - $signature = new Signature($credentials); - - $signature->setHashingAlgorithm('HMAC-SHA1'); - - $uri = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $uri->expects($this->any()) - ->method('getQuery') - ->will($this->returnValue('param1=value1')); - $uri->expects($this->any()) - ->method('getScheme') - ->will($this->returnValue('http')); - $uri->expects($this->any()) - ->method('getRawAuthority') - ->will($this->returnValue('peehaa:pass')); - $uri->expects($this->any()) - ->method('getPath') - ->will($this->returnValue('/')); - $uri->expects($this->any()) - ->method('hasExplicitTrailingHostSlash') - ->will($this->returnValue(true)); - - $this->assertSame('YMHF7FYmLq7wzGnnHWYtd1VoBBE=', $signature->getSignature($uri, array('pee' => 'haa'))); - } - - /** - * @covers OAuth\OAuth1\Signature\Signature::__construct - * @covers OAuth\OAuth1\Signature\Signature::setHashingAlgorithm - * @covers OAuth\OAuth1\Signature\Signature::setTokenSecret - * @covers OAuth\OAuth1\Signature\Signature::getSignature - * @covers OAuth\OAuth1\Signature\Signature::buildSignatureDataString - * @covers OAuth\OAuth1\Signature\Signature::hash - * @covers OAuth\OAuth1\Signature\Signature::getSigningKey - */ - public function testGetSignatureThrowsExceptionOnUnsupportedAlgo() - { - $this->setExpectedException('\\OAuth\\OAuth1\\Signature\\Exception\\UnsupportedHashAlgorithmException'); - - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->any()) - ->method('getConsumerSecret') - ->will($this->returnValue('foo')); - - - $signature = new Signature($credentials); - - $signature->setHashingAlgorithm('UnsupportedAlgo'); - - $uri = $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'); - $uri->expects($this->any()) - ->method('getQuery') - ->will($this->returnValue('param1=value1')); - $uri->expects($this->any()) - ->method('getScheme') - ->will($this->returnValue('http')); - $uri->expects($this->any()) - ->method('getRawAuthority') - ->will($this->returnValue('peehaa:pass')); - $uri->expects($this->any()) - ->method('getPath') - ->will($this->returnValue('/')); - $uri->expects($this->any()) - ->method('hasExplicitTrailingHostSlash') - ->will($this->returnValue(true)); - - $signature->getSignature($uri, array('pee' => 'haa')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Token/StdOAuth1TokenTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth1/Token/StdOAuth1TokenTest.php deleted file mode 100644 index 9b065b1..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth1/Token/StdOAuth1TokenTest.php +++ /dev/null @@ -1,85 +0,0 @@ -assertInstanceOf('\\OAuth\\OAuth1\\Token\\TokenInterface', $token); - $this->assertInstanceOf('\\OAuth\\Common\\Token\\AbstractToken', $token); - } - - /** - * @covers OAuth\OAuth1\Token\StdOAuth1Token::setRequestToken - */ - public function testSetRequestToken() - { - $token = new StdOAuth1Token(); - - $this->assertNull($token->setRequestToken('foo')); - } - - /** - * @covers OAuth\OAuth1\Token\StdOAuth1Token::setRequestToken - * @covers OAuth\OAuth1\Token\StdOAuth1Token::getRequestToken - */ - public function testGetRequestToken() - { - $token = new StdOAuth1Token(); - - $this->assertNull($token->setRequestToken('foo')); - $this->assertSame('foo', $token->getRequestToken()); - } - - /** - * @covers OAuth\OAuth1\Token\StdOAuth1Token::setRequestTokenSecret - */ - public function testSetRequestTokenSecret() - { - $token = new StdOAuth1Token(); - - $this->assertNull($token->setRequestTokenSecret('foo')); - } - - /** - * @covers OAuth\OAuth1\Token\StdOAuth1Token::setRequestTokenSecret - * @covers OAuth\OAuth1\Token\StdOAuth1Token::getRequestTokenSecret - */ - public function testGetRequestTokenSecret() - { - $token = new StdOAuth1Token(); - - $this->assertNull($token->setRequestTokenSecret('foo')); - $this->assertSame('foo', $token->getRequestTokenSecret()); - } - - /** - * @covers OAuth\OAuth1\Token\StdOAuth1Token::setAccessTokenSecret - */ - public function testSetAccessTokenSecret() - { - $token = new StdOAuth1Token(); - - $this->assertNull($token->setAccessTokenSecret('foo')); - } - - /** - * @covers OAuth\OAuth1\Token\StdOAuth1Token::setAccessTokenSecret - * @covers OAuth\OAuth1\Token\StdOAuth1Token::getAccessTokenSecret - */ - public function testGetAccessTokenSecret() - { - $token = new StdOAuth1Token(); - - $this->assertNull($token->setAccessTokenSecret('foo')); - $this->assertSame('foo', $token->getAccessTokenSecret()); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/AbstractServiceTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/AbstractServiceTest.php deleted file mode 100644 index 595db2a..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/AbstractServiceTest.php +++ /dev/null @@ -1,401 +0,0 @@ -getMockForAbstractClass( - '\\OAuth\\OAuth2\\Service\\AbstractService', - array( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - ) - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - */ - public function testConstructCorrectParent() - { - $service = $this->getMockForAbstractClass( - '\\OAuth\\OAuth2\\Service\\AbstractService', - array( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - ) - ); - - $this->assertInstanceOf('\\OAuth\\Common\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - */ - public function testConstructCorrectParentCustomUri() - { - $service = $this->getMockForAbstractClass( - '\\OAuth\\OAuth2\\Service\\AbstractService', - array( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface'), - ) - ); - - $this->assertInstanceOf('\\OAuth\\Common\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - * @covers OAuth\OAuth2\Service\AbstractService::isValidScope - */ - public function testConstructThrowsExceptionOnInvalidScope() - { - $this->setExpectedException('\\OAuth\\OAuth2\\Service\\Exception\\InvalidScopeException'); - - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array('invalidscope') - ); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - * @covers OAuth\OAuth2\Service\AbstractService::getAuthorizationUri - * @covers OAuth\OAuth2\Service\AbstractService::getAuthorizationEndpoint - */ - public function testGetAuthorizationUriWithoutParametersOrScopes() - { - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->once())->method('getConsumerId')->will($this->returnValue('foo')); - $credentials->expects($this->once())->method('getCallbackUrl')->will($this->returnValue('bar')); - - $service = new Mock( - $credentials, - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'http://pieterhordijk.com/auth?type=web_server&client_id=foo&redirect_uri=bar&response_type=code&scope=', - $service->getAuthorizationUri()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - * @covers OAuth\OAuth2\Service\AbstractService::getAuthorizationUri - * @covers OAuth\OAuth2\Service\AbstractService::getAuthorizationEndpoint - */ - public function testGetAuthorizationUriWithParametersWithoutScopes() - { - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->once())->method('getConsumerId')->will($this->returnValue('foo')); - $credentials->expects($this->once())->method('getCallbackUrl')->will($this->returnValue('bar')); - - $service = new Mock( - $credentials, - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'http://pieterhordijk.com/auth?foo=bar&baz=beer&type=web_server&client_id=foo&redirect_uri=bar&response_type=code&scope=', - $service->getAuthorizationUri(array('foo' => 'bar', 'baz' => 'beer'))->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - * @covers OAuth\OAuth2\Service\AbstractService::isValidScope - * @covers OAuth\OAuth2\Service\AbstractService::getAuthorizationUri - * @covers OAuth\OAuth2\Service\AbstractService::getAuthorizationEndpoint - */ - public function testGetAuthorizationUriWithParametersAndScopes() - { - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->once())->method('getConsumerId')->will($this->returnValue('foo')); - $credentials->expects($this->once())->method('getCallbackUrl')->will($this->returnValue('bar')); - - $service = new Mock( - $credentials, - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array('mock', 'mock2') - ); - - $this->assertSame( - 'http://pieterhordijk.com/auth?foo=bar&baz=beer&type=web_server&client_id=foo&redirect_uri=bar&response_type=code&scope=mock+mock2', - $service->getAuthorizationUri(array('foo' => 'bar', 'baz' => 'beer'))->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - * @covers OAuth\OAuth2\Service\AbstractService::requestAccessToken - * @covers OAuth\OAuth2\Service\AbstractService::getAccessTokenEndpoint - * @covers OAuth\OAuth2\Service\AbstractService::getExtraOAuthHeaders - * @covers OAuth\OAuth2\Service\AbstractService::parseAccessTokenResponse - * @covers OAuth\OAuth2\Service\AbstractService::service - */ - public function testRequestAccessToken() - { - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceof('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('code')); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - * @covers OAuth\OAuth2\Service\AbstractService::request - * @covers OAuth\OAuth2\Service\AbstractService::determineRequestUriFromPath - */ - public function testRequestThrowsExceptionWhenTokenIsExpired() - { - $tokenExpiration = new \DateTime('26-03-1984 00:00:00'); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->any())->method('getEndOfLife')->will($this->returnValue($tokenExpiration->format('U'))); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $storage - ); - - $this->setExpectedException('\\OAuth\\Common\\Token\\Exception\\ExpiredTokenException', 'Token expired on 03/26/1984 at 12:00:00 AM'); - - $service->request('https://pieterhordijk.com/my/awesome/path'); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - * @covers OAuth\OAuth2\Service\AbstractService::request - * @covers OAuth\OAuth2\Service\AbstractService::determineRequestUriFromPath - * @covers OAuth\OAuth2\Service\AbstractService::getAuthorizationMethod - * @covers OAuth\OAuth2\Service\AbstractService::parseAccessTokenResponse - * @covers OAuth\OAuth2\Service\AbstractService::service - * @covers OAuth\OAuth2\Service\AbstractService::getExtraApiHeaders - */ - public function testRequestOauthAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('OAuth foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - * @covers OAuth\OAuth2\Service\AbstractService::request - * @covers OAuth\OAuth2\Service\AbstractService::determineRequestUriFromPath - * @covers OAuth\OAuth2\Service\AbstractService::getAuthorizationMethod - * @covers OAuth\OAuth2\Service\AbstractService::parseAccessTokenResponse - * @covers OAuth\OAuth2\Service\AbstractService::service - * @covers OAuth\OAuth2\Service\AbstractService::getExtraApiHeaders - */ - public function testRequestQueryStringMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $service->setAuthorizationMethod('querystring'); - - $uri = $service->request('https://pieterhordijk.com/my/awesome/path'); - $absoluteUri = parse_url($uri->getAbsoluteUri()); - - $this->assertSame('access_token=foo', $absoluteUri['query']); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - * @covers OAuth\OAuth2\Service\AbstractService::request - * @covers OAuth\OAuth2\Service\AbstractService::determineRequestUriFromPath - * @covers OAuth\OAuth2\Service\AbstractService::getAuthorizationMethod - * @covers OAuth\OAuth2\Service\AbstractService::parseAccessTokenResponse - * @covers OAuth\OAuth2\Service\AbstractService::service - * @covers OAuth\OAuth2\Service\AbstractService::getExtraApiHeaders - */ - public function testRequestQueryStringTwoMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $service->setAuthorizationMethod('querystring2'); - - $uri = $service->request('https://pieterhordijk.com/my/awesome/path'); - $absoluteUri = parse_url($uri->getAbsoluteUri()); - - $this->assertSame('oauth2_access_token=foo', $absoluteUri['query']); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - * @covers OAuth\OAuth2\Service\AbstractService::request - * @covers OAuth\OAuth2\Service\AbstractService::determineRequestUriFromPath - * @covers OAuth\OAuth2\Service\AbstractService::getAuthorizationMethod - * @covers OAuth\OAuth2\Service\AbstractService::parseAccessTokenResponse - * @covers OAuth\OAuth2\Service\AbstractService::service - * @covers OAuth\OAuth2\Service\AbstractService::getExtraApiHeaders - */ - public function testRequestBearerMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $service->setAuthorizationMethod('bearer'); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - * @covers OAuth\OAuth2\Service\AbstractService::getStorage - */ - public function testGetStorage() - { - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\Common\\Storage\\TokenStorageInterface', $service->getStorage()); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - * @covers OAuth\OAuth2\Service\AbstractService::refreshAccessToken - * @covers OAuth\OAuth2\Service\AbstractService::getAccessTokenEndpoint - * @covers OAuth\OAuth2\Service\AbstractService::getExtraOAuthHeaders - * @covers OAuth\OAuth2\Service\AbstractService::parseAccessTokenResponse - */ - public function testRefreshAccessTokenSuccess() - { - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\StdOAuth2Token'); - $token->expects($this->once())->method('getRefreshToken')->will($this->returnValue('foo')); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->refreshAccessToken($token)); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - * @covers OAuth\OAuth2\Service\AbstractService::isValidScope - */ - public function testIsValidScopeTrue() - { - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertTrue($service->isValidScope('mock')); - } - - /** - * @covers OAuth\OAuth2\Service\AbstractService::__construct - * @covers OAuth\OAuth2\Service\AbstractService::isValidScope - */ - public function testIsValidScopeFalse() - { - $service = new Mock( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertFalse($service->isValidScope('invalid')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/AmazonTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/AmazonTest.php deleted file mode 100644 index f70fe40..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/AmazonTest.php +++ /dev/null @@ -1,207 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Amazon::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Amazon( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Amazon::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Amazon( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Amazon::__construct - * @covers OAuth\OAuth2\Service\Amazon::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Amazon( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://www.amazon.com/ap/oa', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Amazon::__construct - * @covers OAuth\OAuth2\Service\Amazon::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Amazon( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://www.amazon.com/ap/oatoken', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Amazon::__construct - * @covers OAuth\OAuth2\Service\Amazon::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Amazon( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Amazon::__construct - * @covers OAuth\OAuth2\Service\Amazon::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Amazon( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Amazon::__construct - * @covers OAuth\OAuth2\Service\Amazon::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnErrorDescription() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error_description=some_error')); - - $service = new Amazon( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Amazon::__construct - * @covers OAuth\OAuth2\Service\Amazon::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Amazon( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Amazon::__construct - * @covers OAuth\OAuth2\Service\Amazon::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Amazon( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Amazon::__construct - * @covers OAuth\OAuth2\Service\Amazon::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Amazon( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/BitlyTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/BitlyTest.php deleted file mode 100644 index 9944b26..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/BitlyTest.php +++ /dev/null @@ -1,150 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Bitly::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Bitly( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Bitly::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Bitly( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Bitly::__construct - * @covers OAuth\OAuth2\Service\Bitly::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Bitly( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://bitly.com/oauth/authorize', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Bitly::__construct - * @covers OAuth\OAuth2\Service\Bitly::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Bitly( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://api-ssl.bitly.com/oauth/access_token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Bitly::__construct - * @covers OAuth\OAuth2\Service\Bitly::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Bitly( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $uri = $service->request('https://pieterhordijk.com/my/awesome/path'); - $absoluteUri = parse_url($uri->getAbsoluteUri()); - - $this->assertSame('access_token=foo', $absoluteUri['query']); - } - - /** - * @covers OAuth\OAuth2\Service\Bitly::__construct - * @covers OAuth\OAuth2\Service\Bitly::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Bitly( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Bitly::__construct - * @covers OAuth\OAuth2\Service\Bitly::parseAccessTokenResponse - * @covers OAuth\OAuth2\Service\Bitly::requestAccessToken - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('access_token=foo')); - - $service = new Bitly( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/Bitrix24.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/Bitrix24.php deleted file mode 100644 index 27b58bc..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/Bitrix24.php +++ /dev/null @@ -1,178 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Bitrix24::__construct - * @covers OAuth\OAuth2\Service\Bitrix24::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Bitrix24( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertSame('https://bitrix24.com/oauth/authorize/', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Bitrix24::__construct - * @covers OAuth\OAuth2\Service\Bitrix24::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Bitrix24( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertSame('https://bitrix24.com/oauth/token/', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Bitrix24::__construct - * @covers OAuth\OAuth2\Service\Bitrix24::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Bitrix24( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $uri = $service->request('https://pieterhordijk.com/my/awesome/path'); - $absoluteUri = parse_url($uri->getAbsoluteUri()); - - $this->assertSame('access_token=foo', $absoluteUri['query']); - } - - /** - * @covers OAuth\OAuth2\Service\Bitrix24::__construct - * @covers OAuth\OAuth2\Service\Bitrix24::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Bitrix24( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Bitrix24::__construct - * @covers OAuth\OAuth2\Service\Bitrix24::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"error":"some_error"}')); - - $service = new Bitrix24( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Bitrix24::__construct - * @covers OAuth\OAuth2\Service\Bitrix24::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Bitrix24( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Bitrix24::__construct - * @covers OAuth\OAuth2\Service\Bitrix24::getExtraOAuthHeaders - */ - public function testGetExtraOAuthHeaders() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnCallback(function($uri, $params, $extraHeaders) { - \PHPUnit_Framework_Assert::assertTrue(array_key_exists('Accept', $extraHeaders)); - \PHPUnit_Framework_Assert::assertTrue(in_array('application/json', $extraHeaders, true)); - - return '{"access_token":"foo","expires_in":"bar"}'; - })); - - $service = new Bitrix24( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/BoxTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/BoxTest.php deleted file mode 100644 index b5b2a78..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/BoxTest.php +++ /dev/null @@ -1,207 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Box::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Box( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Box::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Box( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Box::__construct - * @covers OAuth\OAuth2\Service\Box::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Box( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://www.box.com/api/oauth2/authorize', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Box::__construct - * @covers OAuth\OAuth2\Service\Box::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Box( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://www.box.com/api/oauth2/token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Box::__construct - * @covers OAuth\OAuth2\Service\Box::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Box( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Box::__construct - * @covers OAuth\OAuth2\Service\Box::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Box( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Box::__construct - * @covers OAuth\OAuth2\Service\Box::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnErrorDescription() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error_description=some_error')); - - $service = new Box( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Box::__construct - * @covers OAuth\OAuth2\Service\Box::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Box( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Box::__construct - * @covers OAuth\OAuth2\Service\Box::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Box( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Box::__construct - * @covers OAuth\OAuth2\Service\Box::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Box( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/BufferTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/BufferTest.php deleted file mode 100644 index 29726d0..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/BufferTest.php +++ /dev/null @@ -1,150 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Buffer::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Buffer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Buffer::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Buffer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Buffer::__construct - * @covers OAuth\OAuth2\Service\Buffer::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Buffer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://bufferapp.com/oauth2/authorize', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Buffer::__construct - * @covers OAuth\OAuth2\Service\Buffer::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Buffer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://api.bufferapp.com/1/oauth2/token.json', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Buffer::__construct - * @covers OAuth\OAuth2\Service\Buffer::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Buffer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $uri = $service->request('https://pieterhordijk.com/my/awesome/path'); - $absoluteUri = parse_url($uri->getAbsoluteUri()); - - $this->assertSame('access_token=foo', $absoluteUri['query']); - } - - /** - * @covers OAuth\OAuth2\Service\Buffer::__construct - * @covers OAuth\OAuth2\Service\Buffer::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Buffer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Buffer::__construct - * @covers OAuth\OAuth2\Service\Buffer::parseAccessTokenResponse - * @covers OAuth\OAuth2\Service\Buffer::requestAccessToken - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo"}')); - - $service = new Buffer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} \ No newline at end of file diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DailymotionTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DailymotionTest.php deleted file mode 100644 index f3fbaa8..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DailymotionTest.php +++ /dev/null @@ -1,230 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Dailymotion::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Dailymotion( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Dailymotion::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Dailymotion( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Dailymotion::__construct - * @covers OAuth\OAuth2\Service\Dailymotion::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Dailymotion( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://api.dailymotion.com/oauth/authorize', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Dailymotion::__construct - * @covers OAuth\OAuth2\Service\Dailymotion::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Dailymotion( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://api.dailymotion.com/oauth/token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Dailymotion::__construct - * @covers OAuth\OAuth2\Service\Dailymotion::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Dailymotion( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('OAuth foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Dailymotion::__construct - * @covers OAuth\OAuth2\Service\Dailymotion::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Dailymotion( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Dailymotion::__construct - * @covers OAuth\OAuth2\Service\Dailymotion::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnErrorDescription() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error_description=some_error')); - - $service = new Dailymotion( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Dailymotion::__construct - * @covers OAuth\OAuth2\Service\Dailymotion::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Dailymotion( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Dailymotion::__construct - * @covers OAuth\OAuth2\Service\Dailymotion::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Dailymotion( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Dailymotion::__construct - * @covers OAuth\OAuth2\Service\Dailymotion::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Dailymotion( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Dailymotion::__construct - * @covers OAuth\OAuth2\Service\Dailymotion::getExtraOAuthHeaders - */ - public function testGetExtraOAuthHeaders() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnCallback(function($uri, $params, $extraHeaders) { - \PHPUnit_Framework_Assert::assertTrue(array_key_exists('Accept', $extraHeaders)); - \PHPUnit_Framework_Assert::assertTrue(in_array('application/json', $extraHeaders, true)); - - return '{"access_token":"foo","expires_in":"bar"}'; - })); - - $service = new Dailymotion( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DeezerTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DeezerTest.php deleted file mode 100644 index 272212a..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DeezerTest.php +++ /dev/null @@ -1,175 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Deezer::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Deezer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Deezer::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Deezer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Deezer::__construct - * @covers OAuth\OAuth2\Service\Deezer::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Deezer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://connect.deezer.com/oauth/auth.php', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Deezer::__construct - * @covers OAuth\OAuth2\Service\Deezer::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Deezer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://connect.deezer.com/oauth/access_token.php', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Deezer::__construct - * @covers OAuth\OAuth2\Service\Deezer::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Deezer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $uri = $service->request('https://pieterhordijk.com/my/awesome/path'); - $absoluteUri = parse_url($uri->getAbsoluteUri()); - - $this->assertSame('access_token=foo', $absoluteUri['query']); - } - - /** - * @covers OAuth\OAuth2\Service\Deezer::__construct - * @covers OAuth\OAuth2\Service\Deezer::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Deezer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Deezer::__construct - * @covers OAuth\OAuth2\Service\Deezer::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error_reason=user_denied')); - - $service = new Deezer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Deezer::__construct - * @covers OAuth\OAuth2\Service\Deezer::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('access_token=foo&expires=bar')); - - $service = new Deezer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DeliciousTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DeliciousTest.php deleted file mode 100644 index 2d365dc..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DeliciousTest.php +++ /dev/null @@ -1,165 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Delicious::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Delicious( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Delicious::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Delicious( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Delicious::__construct - * @covers OAuth\OAuth2\Service\Delicious::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Delicious( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://delicious.com/auth/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Delicious::__construct - * @covers OAuth\OAuth2\Service\Delicious::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Delicious( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://avosapi.delicious.com/api/v1/oauth/token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Delicious::__construct - * @covers OAuth\OAuth2\Service\Delicious::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Delicious( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Delicious::__construct - * @covers OAuth\OAuth2\Service\Delicious::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Delicious( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Delicious::__construct - * @covers OAuth\OAuth2\Service\Delicious::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Delicious( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Delicious::__construct - * @covers OAuth\OAuth2\Service\Delicious::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Delicious( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DeviantArtTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DeviantArtTest.php deleted file mode 100644 index 075385d..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DeviantArtTest.php +++ /dev/null @@ -1,166 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\DeviantArt::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new DeviantArt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\DeviantArt::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new DeviantArt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\DeviantArt::__construct - * @covers OAuth\OAuth2\Service\DeviantArt::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new DeviantArt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://www.deviantart.com/oauth2/authorize', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\DeviantArt::__construct - * @covers OAuth\OAuth2\Service\DeviantArt::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new DeviantArt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://www.deviantart.com/oauth2/token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\DeviantArt::__construct - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new DeviantArt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('OAuth foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\DeviantArt::__construct - * @covers OAuth\OAuth2\Service\DeviantArt::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new DeviantArt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\DeviantArt::__construct - * @covers OAuth\OAuth2\Service\DeviantArt::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new DeviantArt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\DeviantArt::__construct - * @covers OAuth\OAuth2\Service\DeviantArt::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refersh_token":"baz"}')); - - $service = new DeviantArt( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DropboxTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DropboxTest.php deleted file mode 100644 index 8f052c6..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/DropboxTest.php +++ /dev/null @@ -1,231 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Dropbox::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Dropbox( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Dropbox::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Dropbox( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Dropbox::__construct - * @covers OAuth\OAuth2\Service\Dropbox::getAuthorizationUri - */ - public function testGetAuthorizationUriWithoutAdditionalParams() - { - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->once())->method('getConsumerId')->will($this->returnValue('foo')); - $credentials->expects($this->once())->method('getCallbackUrl')->will($this->returnValue('bar')); - - $service = new Dropbox( - $credentials, - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://www.dropbox.com/1/oauth2/authorize?client_id=foo&redirect_uri=bar&response_type=code&scope=', - $service->getAuthorizationUri()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Dropbox::__construct - * @covers OAuth\OAuth2\Service\Dropbox::getAuthorizationUri - */ - public function testGetAuthorizationUriWithAdditionalParams() - { - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->once())->method('getConsumerId')->will($this->returnValue('foo')); - $credentials->expects($this->once())->method('getCallbackUrl')->will($this->returnValue('bar')); - - $service = new Dropbox( - $credentials, - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://www.dropbox.com/1/oauth2/authorize?client_id=foo&redirect_uri=bar&response_type=code&scope=', - $service->getAuthorizationUri()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Dropbox::__construct - * @covers OAuth\OAuth2\Service\Dropbox::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Dropbox( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://www.dropbox.com/1/oauth2/authorize', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Dropbox::__construct - * @covers OAuth\OAuth2\Service\Dropbox::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Dropbox( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://api.dropbox.com/1/oauth2/token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Dropbox::__construct - * @covers OAuth\OAuth2\Service\Dropbox::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Dropbox( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $uri = $service->request('https://pieterhordijk.com/my/awesome/path'); - $absoluteUri = parse_url($uri->getAbsoluteUri()); - - $this->assertSame('access_token=foo', $absoluteUri['query']); - } - - /** - * @covers OAuth\OAuth2\Service\Dropbox::__construct - * @covers OAuth\OAuth2\Service\Dropbox::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Dropbox( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Dropbox::__construct - * @covers OAuth\OAuth2\Service\Dropbox::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Dropbox( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Dropbox::__construct - * @covers OAuth\OAuth2\Service\Dropbox::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Dropbox( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Dropbox::__construct - * @covers OAuth\OAuth2\Service\Dropbox::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Dropbox( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/EveOnlineTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/EveOnlineTest.php deleted file mode 100644 index 98eedc7..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/EveOnlineTest.php +++ /dev/null @@ -1,209 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\EveOnline::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new EveOnline( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\EveOnline::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new EveOnline( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\EveOnline::__construct - * @covers OAuth\OAuth2\Service\EveOnline::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new EveOnline( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://login.eveonline.com/oauth/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\EveOnline::__construct - * @covers OAuth\OAuth2\Service\EveOnline::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new EveOnline( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://login.eveonline.com/oauth/token', - $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\EveOnline::__construct - * @covers OAuth\OAuth2\Service\EveOnline::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new EveOnline( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\EveOnline::__construct - * @covers OAuth\OAuth2\Service\EveOnline::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new EveOnline( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\EveOnline::__construct - * @covers OAuth\OAuth2\Service\EveOnline::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnErrorDescription() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error_description=some_error')); - - $service = new EveOnline( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\EveOnline::__construct - * @covers OAuth\OAuth2\Service\EveOnline::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new EveOnline( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\EveOnline::__construct - * @covers OAuth\OAuth2\Service\EveOnline::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new EveOnline( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\EveOnline::__construct - * @covers OAuth\OAuth2\Service\EveOnline::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new EveOnline( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/FacebookTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/FacebookTest.php deleted file mode 100644 index f2fed46..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/FacebookTest.php +++ /dev/null @@ -1,242 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Facebook::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Facebook( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Facebook::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Facebook( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Facebook::__construct - * @covers OAuth\OAuth2\Service\Facebook::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Facebook( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://www.facebook.com/dialog/oauth', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Facebook::__construct - * @covers OAuth\OAuth2\Service\Facebook::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Facebook( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://graph.facebook.com/oauth/access_token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Facebook::__construct - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Facebook( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('OAuth foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Facebook::__construct - * @covers OAuth\OAuth2\Service\Facebook::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Facebook( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Facebook::__construct - * @covers OAuth\OAuth2\Service\Facebook::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('access_token=foo&expires=bar')); - - $service = new Facebook( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Facebook::__construct - * @covers OAuth\OAuth2\Service\Facebook::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('access_token=foo&expires=bar&refresh_token=baz')); - - $service = new Facebook( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Facebook::__construct - * @covers OAuth\OAuth2\Service\Facebook::getDialogUri - */ - public function testGetDialogUriRedirectUriMissing() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - - $service = new Facebook( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Exception\\Exception'); - - $service->getDialogUri('feed', array()); - } - - /** - * @covers OAuth\OAuth2\Service\Facebook::__construct - * @covers OAuth\OAuth2\Service\Facebook::getDialogUri - */ - public function testGetDialogUriInstanceofUri() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - - $service = new Facebook( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $dialogUri = $service->getDialogUri( - 'feed', - array( - 'redirect_uri' => 'http://www.facebook.com', - 'state' => 'Random state' - ) - ); - $this->assertInstanceOf('\\OAuth\\Common\\Http\\Uri\\Uri',$dialogUri); - } - - /** - * @covers OAuth\OAuth2\Service\Facebook::__construct - * @covers OAuth\OAuth2\Service\Facebook::getDialogUri - */ - public function testGetDialogUriContainsAppIdAndOtherParameters() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->any())->method('getConsumerId')->will($this->returnValue('application_id')); - - - $service = new Facebook( - $credentials, - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $dialogUri = $service->getDialogUri( - 'feed', - array( - 'redirect_uri' => 'http://www.facebook.com', - 'state' => 'Random state' - ) - ); - - $queryString = $dialogUri->getQuery(); - parse_str($queryString, $queryArray); - - $this->assertArrayHasKey('app_id', $queryArray); - $this->assertArrayHasKey('redirect_uri', $queryArray); - $this->assertArrayHasKey('state', $queryArray); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/FoursquareTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/FoursquareTest.php deleted file mode 100644 index 2d69bce..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/FoursquareTest.php +++ /dev/null @@ -1,225 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Foursquare::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Foursquare( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Foursquare::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Foursquare( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Foursquare::__construct - * @covers OAuth\OAuth2\Service\Foursquare::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Foursquare( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://foursquare.com/oauth2/authenticate', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Foursquare::__construct - * @covers OAuth\OAuth2\Service\Foursquare::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Foursquare( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://foursquare.com/oauth2/access_token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Foursquare::__construct - * @covers OAuth\OAuth2\Service\Foursquare::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Foursquare( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('OAuth foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Foursquare::__construct - * @covers OAuth\OAuth2\Service\Foursquare::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Foursquare( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Foursquare::__construct - * @covers OAuth\OAuth2\Service\Foursquare::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"error":"some_error"}')); - - $service = new Foursquare( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Foursquare::__construct - * @covers OAuth\OAuth2\Service\Foursquare::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Foursquare( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Foursquare::__construct - * @covers OAuth\OAuth2\Service\Foursquare::request - */ - public function testRequest() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Foursquare( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $this->assertSame( - 'https://pieterhordijk.com/my/awesome/path?v=20130829', - $service->request('https://pieterhordijk.com/my/awesome/path')->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Foursquare::__construct - * @covers OAuth\OAuth2\Service\Foursquare::request - */ - public function testRequestShortPath() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Foursquare( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $this->assertSame( - 'https://api.foursquare.com/v2/my/awesome/path?v=20130829', - $service->request('my/awesome/path')->getAbsoluteUri() - ); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/GitHubTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/GitHubTest.php deleted file mode 100644 index edb0fee..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/GitHubTest.php +++ /dev/null @@ -1,220 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\GitHub::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new GitHub( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\GitHub::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new GitHub( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\GitHub::__construct - * @covers OAuth\OAuth2\Service\GitHub::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new GitHub( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://github.com/login/oauth/authorize', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\GitHub::__construct - * @covers OAuth\OAuth2\Service\GitHub::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new GitHub( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://github.com/login/oauth/access_token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\GitHub::__construct - * @covers OAuth\OAuth2\Service\GitHub::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new GitHub( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $uri = $service->request('https://pieterhordijk.com/my/awesome/path'); - $absoluteUri = parse_url($uri->getAbsoluteUri()); - - $this->assertSame('access_token=foo', $absoluteUri['query']); - } - - /** - * @covers OAuth\OAuth2\Service\GitHub::__construct - * @covers OAuth\OAuth2\Service\GitHub::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new GitHub( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\GitHub::__construct - * @covers OAuth\OAuth2\Service\GitHub::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"error":"some_error"}')); - - $service = new GitHub( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\GitHub::__construct - * @covers OAuth\OAuth2\Service\GitHub::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new GitHub( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\GitHub::__construct - * @covers OAuth\OAuth2\Service\GitHub::getExtraOAuthHeaders - */ - public function testGetExtraOAuthHeaders() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnCallback(function($uri, $params, $extraHeaders) { - \PHPUnit_Framework_Assert::assertTrue(array_key_exists('Accept', $extraHeaders)); - \PHPUnit_Framework_Assert::assertTrue(in_array('application/json', $extraHeaders, true)); - - return '{"access_token":"foo","expires_in":"bar"}'; - })); - - $service = new GitHub( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\GitHub::__construct - * @covers OAuth\OAuth2\Service\GitHub::getExtraApiHeaders - */ - public function testGetExtraApiHeaders() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new GitHub( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Accept', $headers)); - $this->assertSame('application/vnd.github.beta+json', $headers['Accept']); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/GoogleTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/GoogleTest.php deleted file mode 100644 index b55808d..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/GoogleTest.php +++ /dev/null @@ -1,195 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Google::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Google( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Google::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Google( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Google::__construct - * @covers OAuth\OAuth2\Service\Google::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Google( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://accounts.google.com/o/oauth2/auth?access_type=online', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - - // Verify that 'offine' works - $service->setAccessType('offline'); - $this->assertSame( - 'https://accounts.google.com/o/oauth2/auth?access_type=offline', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - - } - - /** - * @covers OAuth\OAuth2\Service\Google::__construct - * @covers OAuth\OAuth2\Service\Google::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpointException() - { - $service = new Google( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('OAuth\OAuth2\Service\Exception\InvalidAccessTypeException'); - - try { - $service->setAccessType('invalid'); - } catch (InvalidAccessTypeException $e) { - return; - } - $this->fail('Expected InvalidAccessTypeException not thrown'); - } - - /** - * @covers OAuth\OAuth2\Service\Google::__construct - * @covers OAuth\OAuth2\Service\Google::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Google( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://accounts.google.com/o/oauth2/token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Google::__construct - * @covers OAuth\OAuth2\Service\Google::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Google( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Google::__construct - * @covers OAuth\OAuth2\Service\Google::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Google( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Google::__construct - * @covers OAuth\OAuth2\Service\Google::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Google( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Google::__construct - * @covers OAuth\OAuth2\Service\Google::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Google( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/HerokuTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/HerokuTest.php deleted file mode 100644 index cc2c0f6..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/HerokuTest.php +++ /dev/null @@ -1,261 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Heroku::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Heroku( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Heroku::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Heroku( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Heroku::__construct - * @covers OAuth\OAuth2\Service\Heroku::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Heroku( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://id.heroku.com/oauth/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Heroku::__construct - * @covers OAuth\OAuth2\Service\Heroku::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Heroku( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://id.heroku.com/oauth/token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Heroku::__construct - * @covers OAuth\OAuth2\Service\Heroku::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Heroku( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Heroku::__construct - * @covers OAuth\OAuth2\Service\Heroku::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Heroku( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Heroku::__construct - * @covers OAuth\OAuth2\Service\Heroku::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnErrorDescription() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error_description=some_error')); - - $service = new Heroku( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Heroku::__construct - * @covers OAuth\OAuth2\Service\Heroku::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Heroku( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Heroku::__construct - * @covers OAuth\OAuth2\Service\Heroku::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Heroku( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Heroku::__construct - * @covers OAuth\OAuth2\Service\Heroku::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Heroku( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Heroku::__construct - * @covers OAuth\OAuth2\Service\Heroku::getExtraOAuthHeaders - */ - public function testGetExtraOAuthHeaders() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnCallback(function($uri, $params, $extraHeaders) { - \PHPUnit_Framework_Assert::assertTrue(array_key_exists('Accept', $extraHeaders)); - \PHPUnit_Framework_Assert::assertTrue(in_array('application/vnd.heroku+json; version=3', $extraHeaders, true)); - - return '{"access_token":"foo","expires_in":"bar"}'; - })); - - $service = new Heroku( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Heroku::__construct - * @covers OAuth\OAuth2\Service\Heroku::getExtraApiHeaders - */ - public function testGetExtraApiHeaders() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Heroku( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Accept', $headers)); - $this->assertSame('application/vnd.heroku+json; version=3', $headers['Accept']); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/HubicTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/HubicTest.php deleted file mode 100644 index 4760503..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/HubicTest.php +++ /dev/null @@ -1,165 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Hubic::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Hubic( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Hubic::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Hubic( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Hubic::__construct - * @covers OAuth\OAuth2\Service\Hubic::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Hubic( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://api.hubic.com/oauth/auth', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Hubic::__construct - * @covers OAuth\OAuth2\Service\Hubic::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Hubic( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://api.hubic.com/oauth/token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Hubic::__construct - * @covers OAuth\OAuth2\Service\Hubic::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Hubic( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Hubic::__construct - * @covers OAuth\OAuth2\Service\Hubic::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Hubic( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Hubic::__construct - * @covers OAuth\OAuth2\Service\Hubic::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Hubic( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Hubic::__construct - * @covers OAuth\OAuth2\Service\Hubic::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Hubic( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/InstagramTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/InstagramTest.php deleted file mode 100644 index bf9d764..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/InstagramTest.php +++ /dev/null @@ -1,193 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Instagram::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Instagram( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Instagram::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Instagram( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Instagram::__construct - * @covers OAuth\OAuth2\Service\Instagram::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Instagram( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://api.instagram.com/oauth/authorize/', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Instagram::__construct - * @covers OAuth\OAuth2\Service\Instagram::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Instagram( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://api.instagram.com/oauth/access_token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Instagram::__construct - * @covers OAuth\OAuth2\Service\Instagram::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Instagram( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $uri = $service->request('https://pieterhordijk.com/my/awesome/path'); - $absoluteUri = parse_url($uri->getAbsoluteUri()); - - $this->assertSame('access_token=foo', $absoluteUri['query']); - } - - /** - * @covers OAuth\OAuth2\Service\Instagram::__construct - * @covers OAuth\OAuth2\Service\Instagram::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Instagram( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Instagram::__construct - * @covers OAuth\OAuth2\Service\Instagram::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Instagram( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Instagram::__construct - * @covers OAuth\OAuth2\Service\Instagram::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Instagram( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Instagram::__construct - * @covers OAuth\OAuth2\Service\Instagram::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Instagram( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/JawboneUPTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/JawboneUPTest.php deleted file mode 100644 index 8a6bb70..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/JawboneUPTest.php +++ /dev/null @@ -1,207 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\JawboneUP::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new JawboneUP( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\JawboneUP::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new JawboneUP( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\JawboneUP::__construct - * @covers OAuth\OAuth2\Service\JawboneUP::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new JawboneUP( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://jawbone.com/auth/oauth2/auth', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\JawboneUP::__construct - * @covers OAuth\OAuth2\Service\JawboneUP::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new JawboneUP( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://jawbone.com/auth/oauth2/token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\JawboneUP::__construct - * @covers OAuth\OAuth2\Service\JawboneUP::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new JawboneUP( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('/users/@me'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\JawboneUP::__construct - * @covers OAuth\OAuth2\Service\JawboneUP::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new JawboneUP( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\JawboneUP::__construct - * @covers OAuth\OAuth2\Service\JawboneUP::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnErrorDescription() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error_description=some_error')); - - $service = new JawboneUP( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\JawboneUP::__construct - * @covers OAuth\OAuth2\Service\JawboneUP::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new JawboneUP( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\JawboneUP::__construct - * @covers OAuth\OAuth2\Service\JawboneUP::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new JawboneUP( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\JawboneUP::__construct - * @covers OAuth\OAuth2\Service\JawboneUP::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new JawboneUP( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/LinkedinTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/LinkedinTest.php deleted file mode 100644 index e46fc82..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/LinkedinTest.php +++ /dev/null @@ -1,212 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Linkedin::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Linkedin( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Linkedin::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Linkedin( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Linkedin::__construct - * @covers OAuth\OAuth2\Service\Linkedin::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Linkedin( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://www.linkedin.com/uas/oauth2/authorization', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Linkedin::__construct - * @covers OAuth\OAuth2\Service\Linkedin::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Linkedin( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://www.linkedin.com/uas/oauth2/accessToken', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Linkedin::__construct - * @covers OAuth\OAuth2\Service\Linkedin::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Linkedin( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Linkedin::__construct - * @covers OAuth\OAuth2\Service\Linkedin::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Linkedin( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Linkedin::__construct - * @covers OAuth\OAuth2\Service\Linkedin::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnErrorDescription() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error_description=some_error')); - - $service = new Linkedin( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Linkedin::__construct - * @covers OAuth\OAuth2\Service\Linkedin::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Linkedin( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Linkedin::__construct - * @covers OAuth\OAuth2\Service\Linkedin::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Linkedin( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Linkedin::__construct - * @covers OAuth\OAuth2\Service\Linkedin::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Linkedin( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/MailchimpTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/MailchimpTest.php deleted file mode 100644 index e7f955e..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/MailchimpTest.php +++ /dev/null @@ -1,179 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Mailchimp::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Mailchimp( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Mailchimp::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Mailchimp( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Mailchimp::__construct - * @covers OAuth\OAuth2\Service\Mailchimp::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Mailchimp( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://login.mailchimp.com/oauth2/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Mailchimp::__construct - * @covers OAuth\OAuth2\Service\Mailchimp::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Mailchimp( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://login.mailchimp.com/oauth2/token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Mailchimp::__construct - * @covers OAuth\OAuth2\Service\Mailchimp::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\StdOAuth2Token'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Mailchimp( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage, - array(), - new Uri('https://us1.api.mailchimp.com/2.0/') - ); - - $uri = $service->request('https://pieterhordijk.com/my/awesome/path'); - $absoluteUri = parse_url($uri->getAbsoluteUri()); - - $this->assertSame('apikey=foo', $absoluteUri['query']); - } - - /** - * @covers OAuth\OAuth2\Service\Mailchimp::__construct - * @covers OAuth\OAuth2\Service\Mailchimp::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Mailchimp( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Mailchimp::__construct - * @covers OAuth\OAuth2\Service\Mailchimp::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Mailchimp( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Mailchimp::__construct - * @covers OAuth\OAuth2\Service\Mailchimp::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->at(0))->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - $client->expects($this->at(1))->method('retrieveResponse')->will($this->returnValue('{"dc": "us7"}')); - - $service = new Mailchimp( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/MicrosoftTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/MicrosoftTest.php deleted file mode 100644 index 4001e1e..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/MicrosoftTest.php +++ /dev/null @@ -1,193 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Microsoft::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Microsoft( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Microsoft::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Microsoft( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Microsoft::__construct - * @covers OAuth\OAuth2\Service\Microsoft::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Microsoft( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://login.live.com/oauth20_authorize.srf', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Microsoft::__construct - * @covers OAuth\OAuth2\Service\Microsoft::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Microsoft( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://login.live.com/oauth20_token.srf', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Microsoft::__construct - * @covers OAuth\OAuth2\Service\Microsoft::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Microsoft( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $uri = $service->request('https://pieterhordijk.com/my/awesome/path'); - $absoluteUri = parse_url($uri->getAbsoluteUri()); - - $this->assertSame('access_token=foo', $absoluteUri['query']); - } - - /** - * @covers OAuth\OAuth2\Service\Microsoft::__construct - * @covers OAuth\OAuth2\Service\Microsoft::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Microsoft( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Microsoft::__construct - * @covers OAuth\OAuth2\Service\Microsoft::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Microsoft( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Microsoft::__construct - * @covers OAuth\OAuth2\Service\Microsoft::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Microsoft( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Microsoft::__construct - * @covers OAuth\OAuth2\Service\Microsoft::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Microsoft( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/NestTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/NestTest.php deleted file mode 100644 index 85c8ec8..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/NestTest.php +++ /dev/null @@ -1,212 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Nest::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Nest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Nest::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Nest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Nest::__construct - * @covers OAuth\OAuth2\Service\Nest::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Nest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://home.nest.com/login/oauth2', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Nest::__construct - * @covers OAuth\OAuth2\Service\Nest::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Nest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://api.home.nest.com/oauth2/access_token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Nest::__construct - * @covers OAuth\OAuth2\Service\Nest::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(0)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Nest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $uri = $service->request('https://pieterhordijk.com/my/awesome/path'); - $absoluteUri = parse_url($uri->getAbsoluteUri()); - $this->assertSame('auth=foo', $absoluteUri['query']); - } - - /** - * @covers OAuth\OAuth2\Service\Nest::__construct - * @covers OAuth\OAuth2\Service\Nest::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Nest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Nest::__construct - * @covers OAuth\OAuth2\Service\Nest::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnErrorDescription() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error_description=some_error')); - - $service = new Nest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Nest::__construct - * @covers OAuth\OAuth2\Service\Nest::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Nest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Nest::__construct - * @covers OAuth\OAuth2\Service\Nest::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Nest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Nest::__construct - * @covers OAuth\OAuth2\Service\Nest::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Nest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/NetatmoTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/NetatmoTest.php deleted file mode 100644 index c96b6f2..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/NetatmoTest.php +++ /dev/null @@ -1,165 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Netatmo::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Netatmo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Netatmo::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Netatmo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Netatmo::__construct - * @covers OAuth\OAuth2\Service\Netatmo::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Netatmo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://api.netatmo.net/oauth2/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Netatmo::__construct - * @covers OAuth\OAuth2\Service\Netatmo::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Netatmo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://api.netatmo.net/oauth2/token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Netatmo::__construct - * @covers OAuth\OAuth2\Service\Netatmo::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Netatmo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Netatmo::__construct - * @covers OAuth\OAuth2\Service\Netatmo::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Netatmo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Netatmo::__construct - * @covers OAuth\OAuth2\Service\Netatmo::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Netatmo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Netatmo::__construct - * @covers OAuth\OAuth2\Service\Netatmo::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Netatmo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/ParrotFlowerPowerTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/ParrotFlowerPowerTest.php deleted file mode 100644 index 5a1e294..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/ParrotFlowerPowerTest.php +++ /dev/null @@ -1,165 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\ParrotFlowerPower::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new ParrotFlowerPower( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\ParrotFlowerPower::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new ParrotFlowerPower( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\ParrotFlowerPower::__construct - * @covers OAuth\OAuth2\Service\ParrotFlowerPower::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new ParrotFlowerPower( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://apiflowerpower.parrot.com/oauth2/v1/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\ParrotFlowerPower::__construct - * @covers OAuth\OAuth2\Service\ParrotFlowerPower::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new ParrotFlowerPower( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://apiflowerpower.parrot.com/user/v1/authenticate', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\ParrotFlowerPower::__construct - * @covers OAuth\OAuth2\Service\ParrotFlowerPower::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new ParrotFlowerPower( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\ParrotFlowerPower::__construct - * @covers OAuth\OAuth2\Service\ParrotFlowerPower::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new ParrotFlowerPower( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\ParrotFlowerPower::__construct - * @covers OAuth\OAuth2\Service\ParrotFlowerPower::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new ParrotFlowerPower( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\ParrotFlowerPower::__construct - * @covers OAuth\OAuth2\Service\ParrotFlowerPower::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new ParrotFlowerPower( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/PaypalTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/PaypalTest.php deleted file mode 100644 index 5396326..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/PaypalTest.php +++ /dev/null @@ -1,213 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Paypal::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Paypal( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Paypal::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Paypal( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Paypal::__construct - * @covers OAuth\OAuth2\Service\Paypal::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Paypal( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Paypal::__construct - * @covers OAuth\OAuth2\Service\Paypal::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Paypal( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://api.paypal.com/v1/identity/openidconnect/tokenservice', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Paypal::__construct - * @covers OAuth\OAuth2\Service\Paypal::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Paypal( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Paypal::__construct - * @covers OAuth\OAuth2\Service\Paypal::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Paypal( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Paypal::__construct - * @covers OAuth\OAuth2\Service\Paypal::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnMessage() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('message=some_error')); - - $service = new Paypal( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Paypal::__construct - * @covers OAuth\OAuth2\Service\Paypal::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnName() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('name=some_error')); - - $service = new Paypal( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Paypal::__construct - * @covers OAuth\OAuth2\Service\Paypal::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Paypal( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Paypal::__construct - * @covers OAuth\OAuth2\Service\Paypal::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Paypal( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/PinterestTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/PinterestTest.php deleted file mode 100644 index f4f53fe..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/PinterestTest.php +++ /dev/null @@ -1,195 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Pinterest::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Pinterest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Pinterest::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Pinterest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Pinterest::__construct - * @covers OAuth\OAuth2\Service\Pinterest::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Pinterest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://api.pinterest.com/oauth/', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Pinterest::__construct - * @covers OAuth\OAuth2\Service\Pinterest::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Pinterest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://api.pinterest.com/v1/oauth/token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Box::__construct - * @covers OAuth\OAuth2\Service\Box::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Pinterest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Pinterest::__construct - * @covers OAuth\OAuth2\Service\Pinterest::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Pinterest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Pinterest::__construct - * @covers OAuth\OAuth2\Service\Pinterest::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnErrorDescription() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error_description=some_error')); - - $service = new Pinterest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Pinterest::__construct - * @covers OAuth\OAuth2\Service\Pinterest::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Pinterest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Pinterest::__construct - * @covers OAuth\OAuth2\Service\Pinterest::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Pinterest( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/RedditTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/RedditTest.php deleted file mode 100644 index e8741e6..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/RedditTest.php +++ /dev/null @@ -1,193 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Reddit::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Reddit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Reddit::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Reddit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Reddit::__construct - * @covers OAuth\OAuth2\Service\Reddit::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Reddit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://ssl.reddit.com/api/v1/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Reddit::__construct - * @covers OAuth\OAuth2\Service\Reddit::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Reddit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://ssl.reddit.com/api/v1/access_token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Reddit::__construct - * @covers OAuth\OAuth2\Service\Reddit::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Reddit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Reddit::__construct - * @covers OAuth\OAuth2\Service\Reddit::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Reddit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Reddit::__construct - * @covers OAuth\OAuth2\Service\Reddit::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Reddit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Reddit::__construct - * @covers OAuth\OAuth2\Service\Reddit::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Reddit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Reddit::__construct - * @covers OAuth\OAuth2\Service\Reddit::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Reddit( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/RunKeeperTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/RunKeeperTest.php deleted file mode 100644 index 671bd0c..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/RunKeeperTest.php +++ /dev/null @@ -1,207 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\RunKeeper::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new RunKeeper( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\RunKeeper::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new RunKeeper( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\RunKeeper::__construct - * @covers OAuth\OAuth2\Service\RunKeeper::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new RunKeeper( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://runkeeper.com/apps/authorize', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\RunKeeper::__construct - * @covers OAuth\OAuth2\Service\RunKeeper::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new RunKeeper( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://runkeeper.com/apps/token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\RunKeeper::__construct - * @covers OAuth\OAuth2\Service\RunKeeper::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new RunKeeper( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('/user'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\RunKeeper::__construct - * @covers OAuth\OAuth2\Service\RunKeeper::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new RunKeeper( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\RunKeeper::__construct - * @covers OAuth\OAuth2\Service\RunKeeper::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnErrorDescription() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error_description=some_error')); - - $service = new RunKeeper( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\RunKeeper::__construct - * @covers OAuth\OAuth2\Service\RunKeeper::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new RunKeeper( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\RunKeeper::__construct - * @covers OAuth\OAuth2\Service\RunKeeper::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new RunKeeper( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\RunKeeper::__construct - * @covers OAuth\OAuth2\Service\RunKeeper::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new RunKeeper( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/SoundCloudTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/SoundCloudTest.php deleted file mode 100644 index ac988ba..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/SoundCloudTest.php +++ /dev/null @@ -1,159 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\SoundCloud::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new SoundCloud( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\SoundCloud::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new SoundCloud( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\SoundCloud::__construct - * @covers OAuth\OAuth2\Service\SoundCloud::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new SoundCloud( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://soundcloud.com/connect', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\SoundCloud::__construct - * @covers OAuth\OAuth2\Service\SoundCloud::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new SoundCloud( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://api.soundcloud.com/oauth2/token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\SoundCloud::__construct - * @covers OAuth\OAuth2\Service\SoundCloud::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new SoundCloud( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\SoundCloud::__construct - * @covers OAuth\OAuth2\Service\SoundCloud::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new SoundCloud( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\SoundCloud::__construct - * @covers OAuth\OAuth2\Service\SoundCloud::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new SoundCloud( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\SoundCloud::__construct - * @covers OAuth\OAuth2\Service\SoundCloud::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new SoundCloud( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/SpotifyTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/SpotifyTest.php deleted file mode 100644 index b3ae93c..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/SpotifyTest.php +++ /dev/null @@ -1,214 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Spotify::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Spotify( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Spotify::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Spotify( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Spotify::__construct - * @covers OAuth\OAuth2\Service\Spotify::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Spotify( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://accounts.spotify.com/authorize', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Spotify::__construct - * @covers OAuth\OAuth2\Service\Spotify::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Spotify( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://accounts.spotify.com/api/token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Spotify::__construct - * @covers OAuth\OAuth2\Service\Spotify::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Spotify( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Spotify::__construct - * @covers OAuth\OAuth2\Service\Spotify::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Spotify( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Spotify::__construct - * @covers OAuth\OAuth2\Service\Spotify::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Spotify( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Spotify::__construct - * @covers OAuth\OAuth2\Service\Spotify::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Spotify( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Spotify::__construct - * @covers OAuth\OAuth2\Service\Spotify::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Spotify( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Spotify::__construct - * @covers OAuth\OAuth2\Service\Spotify::getExtraOAuthHeaders - */ - public function testGetExtraOAuthHeaders() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnCallback(function($uri, $params, $extraHeaders) { - \PHPUnit_Framework_Assert::assertTrue(array_key_exists('Authorization', $extraHeaders)); - \PHPUnit_Framework_Assert::assertSame('Basic ' . base64_encode('foo:bar'), $extraHeaders['Authorization']); - - return '{"access_token":"foo","expires_in":"bar"}'; - })); - - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->any())->method('getConsumerId')->will($this->returnValue('foo')); - $credentials->expects($this->any())->method('getConsumerSecret')->will($this->returnValue('bar')); - - $service = new Spotify( - $credentials, - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/StravaTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/StravaTest.php deleted file mode 100644 index 504b217..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/StravaTest.php +++ /dev/null @@ -1,177 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Strava::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Strava( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Strava::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Strava( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Strava::__construct - * @covers OAuth\OAuth2\Service\Strava::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Strava( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://www.strava.com/oauth/authorize?approval_prompt=auto', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - - // Verify that 'offine' works - $service->setApprouvalPrompt('force'); - $this->assertSame( - 'https://www.strava.com/oauth/authorize?approval_prompt=force', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - - } - - /** - * @covers OAuth\OAuth2\Service\Strava::__construct - * @covers OAuth\OAuth2\Service\Strava::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpointException() - { - $service = new Strava( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('OAuth\OAuth2\Service\Exception\InvalidAccessTypeException'); - - try { - $service->setApprouvalPrompt('invalid'); - } catch (InvalidAccessTypeException $e) { - return; - } - $this->fail('Expected InvalidAccessTypeException not thrown'); - } - - /** - * @covers OAuth\OAuth2\Service\Strava::__construct - * @covers OAuth\OAuth2\Service\Strava::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Strava( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://www.strava.com/oauth/token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Strava::__construct - * @covers OAuth\OAuth2\Service\Strava::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Strava( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Strava::__construct - * @covers OAuth\OAuth2\Service\Strava::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Strava( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Strava::__construct - * @covers OAuth\OAuth2\Service\Strava::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValid() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Strava( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/UstreamTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/UstreamTest.php deleted file mode 100644 index 48965ae..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/UstreamTest.php +++ /dev/null @@ -1,193 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Ustream::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Ustream( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Ustream::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Ustream( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Ustream::__construct - * @covers OAuth\OAuth2\Service\Ustream::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Ustream( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://www.ustream.tv/oauth2/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Ustream::__construct - * @covers OAuth\OAuth2\Service\Ustream::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Ustream( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://www.ustream.tv/oauth2/token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Ustream::__construct - * @covers OAuth\OAuth2\Service\Ustream::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Ustream( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Ustream::__construct - * @covers OAuth\OAuth2\Service\Ustream::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Ustream( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Ustream::__construct - * @covers OAuth\OAuth2\Service\Ustream::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Ustream( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Ustream::__construct - * @covers OAuth\OAuth2\Service\Ustream::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Ustream( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Ustream::__construct - * @covers OAuth\OAuth2\Service\Ustream::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Ustream( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/VimeoTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/VimeoTest.php deleted file mode 100644 index 47cdc26..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/VimeoTest.php +++ /dev/null @@ -1,193 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Vimeo::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Vimeo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Vimeo::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Vimeo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Vimeo::__construct - * @covers OAuth\OAuth2\Service\Vimeo::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Vimeo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://api.vimeo.com/oauth/authorize', - $service->getAuthorizationEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Vimeo::__construct - * @covers OAuth\OAuth2\Service\Vimeo::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Vimeo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame( - 'https://api.vimeo.com/oauth/access_token', - $service->getAccessTokenEndpoint()->getAbsoluteUri() - ); - } - - /** - * @covers OAuth\OAuth2\Service\Vimeo::__construct - * @covers OAuth\OAuth2\Service\Vimeo::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Vimeo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Vimeo::__construct - * @covers OAuth\OAuth2\Service\Vimeo::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Vimeo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Vimeo::__construct - * @covers OAuth\OAuth2\Service\Vimeo::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Vimeo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Vimeo::__construct - * @covers OAuth\OAuth2\Service\Vimeo::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Vimeo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Vimeo::__construct - * @covers OAuth\OAuth2\Service\Vimeo::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Vimeo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/VkontakteTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/VkontakteTest.php deleted file mode 100644 index 7a8279b..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/VkontakteTest.php +++ /dev/null @@ -1,159 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Vkontakte::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Vkontakte( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Vkontakte::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Vkontakte( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Vkontakte::__construct - * @covers OAuth\OAuth2\Service\Vkontakte::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Vkontakte( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://oauth.vk.com/authorize', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Vkontakte::__construct - * @covers OAuth\OAuth2\Service\Vkontakte::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Vkontakte( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://oauth.vk.com/access_token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Vkontakte::__construct - * @covers OAuth\OAuth2\Service\Vkontakte::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Vkontakte( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Vkontakte::__construct - * @covers OAuth\OAuth2\Service\Vkontakte::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Vkontakte( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Vkontakte::__construct - * @covers OAuth\OAuth2\Service\Vkontakte::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Vkontakte( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Vkontakte::__construct - * @covers OAuth\OAuth2\Service\Vkontakte::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Vkontakte( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/YahooTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/YahooTest.php deleted file mode 100644 index 29c17cb..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/YahooTest.php +++ /dev/null @@ -1,214 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Yahoo::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Yahoo::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Yahoo::__construct - * @covers OAuth\OAuth2\Service\Yahoo::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://api.login.yahoo.com/oauth2/request_auth', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Yahoo::__construct - * @covers OAuth\OAuth2\Service\Yahoo::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://api.login.yahoo.com/oauth2/get_token', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Yahoo::__construct - * @covers OAuth\OAuth2\Service\Yahoo::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Yahoo::__construct - * @covers OAuth\OAuth2\Service\Yahoo::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Yahoo::__construct - * @covers OAuth\OAuth2\Service\Yahoo::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Yahoo::__construct - * @covers OAuth\OAuth2\Service\Yahoo::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar"}')); - - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Yahoo::__construct - * @covers OAuth\OAuth2\Service\Yahoo::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":"foo","expires_in":"bar","refresh_token":"baz"}')); - - $service = new Yahoo( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Yahoo::__construct - * @covers OAuth\OAuth2\Service\Yahoo::getExtraOAuthHeaders - */ - public function testGetExtraOAuthHeaders() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnCallback(function($uri, $params, $extraHeaders) { - \PHPUnit_Framework_Assert::assertTrue(array_key_exists('Authorization', $extraHeaders)); - \PHPUnit_Framework_Assert::assertSame('Basic ' . base64_encode('foo:bar'), $extraHeaders['Authorization']); - - return '{"access_token":"foo","expires_in":"bar"}'; - })); - - $credentials = $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'); - $credentials->expects($this->any())->method('getConsumerId')->will($this->returnValue('foo')); - $credentials->expects($this->any())->method('getConsumerSecret')->will($this->returnValue('bar')); - - $service = new Yahoo( - $credentials, - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/YammerTest.php b/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/YammerTest.php deleted file mode 100644 index 8644039..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/OAuth2/Service/YammerTest.php +++ /dev/null @@ -1,187 +0,0 @@ -getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\ServiceInterface', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Yammer::__construct - */ - public function testConstructCorrectInstanceWithoutCustomUri() - { - $service = new Yammer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Yammer::__construct - */ - public function testConstructCorrectInstanceWithCustomUri() - { - $service = new Yammer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array(), - $this->getMock('\\OAuth\\Common\\Http\\Uri\\UriInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\AbstractService', $service); - } - - /** - * @covers OAuth\OAuth2\Service\Yammer::__construct - * @covers OAuth\OAuth2\Service\Yammer::getAuthorizationEndpoint - */ - public function testGetAuthorizationEndpoint() - { - $service = new Yammer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://www.yammer.com/dialog/oauth', $service->getAuthorizationEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Yammer::__construct - * @covers OAuth\OAuth2\Service\Yammer::getAccessTokenEndpoint - */ - public function testGetAccessTokenEndpoint() - { - $service = new Yammer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertSame('https://www.yammer.com/oauth2/access_token.json', $service->getAccessTokenEndpoint()->getAbsoluteUri()); - } - - /** - * @covers OAuth\OAuth2\Service\Yammer::__construct - * @covers OAuth\OAuth2\Service\Yammer::getAuthorizationMethod - */ - public function testGetAuthorizationMethod() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnArgument(2)); - - $token = $this->getMock('\\OAuth\\OAuth2\\Token\\TokenInterface'); - $token->expects($this->once())->method('getEndOfLife')->will($this->returnValue(TokenInterface::EOL_NEVER_EXPIRES)); - $token->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); - - $storage = $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'); - $storage->expects($this->once())->method('retrieveAccessToken')->will($this->returnValue($token)); - - $service = new Yammer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $storage - ); - - $headers = $service->request('https://pieterhordijk.com/my/awesome/path'); - - $this->assertTrue(array_key_exists('Authorization', $headers)); - $this->assertTrue(in_array('Bearer foo', $headers, true)); - } - - /** - * @covers OAuth\OAuth2\Service\Yammer::__construct - * @covers OAuth\OAuth2\Service\Yammer::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnNulledResponse() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue(null)); - - $service = new Yammer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Yammer::__construct - * @covers OAuth\OAuth2\Service\Yammer::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseThrowsExceptionOnError() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('error=some_error')); - - $service = new Yammer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->setExpectedException('\\OAuth\\Common\\Http\\Exception\\TokenResponseException'); - - $service->requestAccessToken('foo'); - } - - /** - * @covers OAuth\OAuth2\Service\Yammer::__construct - * @covers OAuth\OAuth2\Service\Yammer::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithoutRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":{"token":"foo", "expires_at":null}}')); - - $service = new Yammer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } - - /** - * @covers OAuth\OAuth2\Service\Yammer::__construct - * @covers OAuth\OAuth2\Service\Yammer::parseAccessTokenResponse - */ - public function testParseAccessTokenResponseValidWithRefreshToken() - { - $client = $this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface'); - $client->expects($this->once())->method('retrieveResponse')->will($this->returnValue('{"access_token":{"token":"foo", "expires_at":null},"refresh_token":"baz"}')); - - $service = new Yammer( - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $client, - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Token\\StdOAuth2Token', $service->requestAccessToken('foo')); - } -} diff --git a/vendor/lusitanian/oauth/tests/Unit/ServiceFactoryTest.php b/vendor/lusitanian/oauth/tests/Unit/ServiceFactoryTest.php deleted file mode 100644 index 26588dc..0000000 --- a/vendor/lusitanian/oauth/tests/Unit/ServiceFactoryTest.php +++ /dev/null @@ -1,311 +0,0 @@ - - * @author Chris Heng - * @author Pieter Hordijk - * @copyright Copyright (c) 2013 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ -namespace OAuth\Unit; - -use OAuth\ServiceFactory; - -class ServiceFactoryTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers OAuth\ServiceFactory::setHttpClient - */ - public function testSetHttpClient() - { - $factory = new ServiceFactory(); - - $this->assertInstanceOf( - '\\OAuth\\ServiceFactory', - $factory->setHttpClient($this->getMock('\\OAuth\\Common\\Http\\Client\\ClientInterface')) - ); - } - - /** - * @covers OAuth\ServiceFactory::registerService - */ - public function testRegisterServiceThrowsExceptionNonExistentClass() - { - $this->setExpectedException('\\OAuth\Common\Exception\Exception'); - - $factory = new ServiceFactory(); - $factory->registerService('foo', 'bar'); - } - - /** - * @covers OAuth\ServiceFactory::registerService - */ - public function testRegisterServiceThrowsExceptionWithClassIncorrectImplementation() - { - $this->setExpectedException('\\OAuth\Common\Exception\Exception'); - - $factory = new ServiceFactory(); - $factory->registerService('foo', 'OAuth\\ServiceFactory'); - } - - /** - * @covers OAuth\ServiceFactory::registerService - */ - public function testRegisterServiceSuccessOAuth1() - { - $factory = new ServiceFactory(); - - $this->assertInstanceOf( - '\\OAuth\\ServiceFactory', - $factory->registerService('foo', '\\OAuthTest\\Mocks\\OAuth1\\Service\\Fake') - ); - } - - /** - * @covers OAuth\ServiceFactory::registerService - */ - public function testRegisterServiceSuccessOAuth2() - { - $factory = new ServiceFactory(); - - $this->assertInstanceOf( - '\\OAuth\\ServiceFactory', - $factory->registerService('foo', '\\OAuthTest\\Mocks\\OAuth2\\Service\\Fake') - ); - } - - /** - * @covers OAuth\ServiceFactory::createService - * @covers OAuth\ServiceFactory::getFullyQualifiedServiceName - * @covers OAuth\ServiceFactory::buildV1Service - */ - public function testCreateServiceOAuth1NonRegistered() - { - $factory = new ServiceFactory(); - - $service = $factory->createService( - 'twitter', - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth1\\Service\\Twitter', $service); - } - - /** - * @covers OAuth\ServiceFactory::registerService - * @covers OAuth\ServiceFactory::createService - * @covers OAuth\ServiceFactory::getFullyQualifiedServiceName - * @covers OAuth\ServiceFactory::buildV1Service - */ - public function testCreateServiceOAuth1Registered() - { - $factory = new ServiceFactory(); - - $factory->registerService('foo', '\\OAuthTest\\Mocks\\OAuth1\\Service\\Fake'); - - $service = $factory->createService( - 'foo', - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\OAuth1\Service\\ServiceInterface', $service); - $this->assertInstanceOf('\\OAuthTest\\Mocks\\OAuth1\\Service\\Fake', $service); - } - - /** - * @covers OAuth\ServiceFactory::registerService - * @covers OAuth\ServiceFactory::createService - * @covers OAuth\ServiceFactory::getFullyQualifiedServiceName - * @covers OAuth\ServiceFactory::buildV1Service - */ - public function testCreateServiceOAuth1RegisteredAndNonRegisteredSameName() - { - $factory = new ServiceFactory(); - - $factory->registerService('twitter', '\\OAuthTest\\Mocks\\OAuth1\\Service\\Fake'); - - $service = $factory->createService( - 'twitter', - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\OAuth1\Service\\ServiceInterface', $service); - $this->assertInstanceOf('\\OAuthTest\\Mocks\\OAuth1\\Service\\Fake', $service); - } - - /** - * @covers OAuth\ServiceFactory::createService - * @covers OAuth\ServiceFactory::getFullyQualifiedServiceName - * @covers OAuth\ServiceFactory::buildV2Service - * @covers OAuth\ServiceFactory::resolveScopes - */ - public function testCreateServiceOAuth2NonRegistered() - { - $factory = new ServiceFactory(); - - $service = $factory->createService( - 'facebook', - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\\OAuth2\\Service\\Facebook', $service); - } - - /** - * @covers OAuth\ServiceFactory::createService - * @covers OAuth\ServiceFactory::getFullyQualifiedServiceName - * @covers OAuth\ServiceFactory::buildV2Service - * @covers OAuth\ServiceFactory::resolveScopes - */ - public function testCreateServiceOAuth2Registered() - { - $factory = new ServiceFactory(); - - $factory->registerService('foo', '\\OAuthTest\\Mocks\\OAuth2\\Service\\Fake'); - - $service = $factory->createService( - 'foo', - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\OAuth2\Service\\ServiceInterface', $service); - $this->assertInstanceOf('\\OAuthTest\\Mocks\\OAuth2\\Service\\Fake', $service); - } - - /** - * @covers OAuth\ServiceFactory::createService - * @covers OAuth\ServiceFactory::getFullyQualifiedServiceName - * @covers OAuth\ServiceFactory::buildV2Service - * @covers OAuth\ServiceFactory::resolveScopes - */ - public function testCreateServiceOAuth2RegisteredAndNonRegisteredSameName() - { - $factory = new ServiceFactory(); - - $factory->registerService('facebook', '\\OAuthTest\\Mocks\\OAuth2\\Service\\Fake'); - - $service = $factory->createService( - 'facebook', - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\OAuth2\Service\\ServiceInterface', $service); - $this->assertInstanceOf('\\OAuthTest\\Mocks\\OAuth2\\Service\\Fake', $service); - } - - /** - * @covers OAuth\ServiceFactory::registerService - * @covers OAuth\ServiceFactory::createService - * @covers OAuth\ServiceFactory::getFullyQualifiedServiceName - * @covers OAuth\ServiceFactory::buildV1Service - */ - public function testCreateServiceThrowsExceptionOnPassingScopesToV1Service() - { - $this->setExpectedException('\\OAuth\Common\Exception\Exception'); - - $factory = new ServiceFactory(); - - $factory->registerService('foo', '\\OAuthTest\\Mocks\\OAuth1\\Service\\Fake'); - - $service = $factory->createService( - 'foo', - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array('bar') - ); - } - - /** - * @covers OAuth\ServiceFactory::createService - * @covers OAuth\ServiceFactory::getFullyQualifiedServiceName - */ - public function testCreateServiceNonExistentService() - { - $factory = new ServiceFactory(); - - $service = $factory->createService( - 'foo', - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertNull($service); - } - - /** - * @covers OAuth\ServiceFactory::registerService - * @covers OAuth\ServiceFactory::createService - * @covers OAuth\ServiceFactory::getFullyQualifiedServiceName - * @covers OAuth\ServiceFactory::buildV2Service - * @covers OAuth\ServiceFactory::resolveScopes - */ - public function testCreateServicePrefersOauth2() - { - $factory = new ServiceFactory(); - - $factory->registerService('foo', '\\OAuthTest\\Mocks\\OAuth1\\Service\\Fake'); - $factory->registerService('foo', '\\OAuthTest\\Mocks\\OAuth2\\Service\\Fake'); - - $service = $factory->createService( - 'foo', - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface') - ); - - $this->assertInstanceOf('\\OAuth\OAuth2\Service\\ServiceInterface', $service); - $this->assertInstanceOf('\\OAuthTest\\Mocks\\OAuth2\\Service\\Fake', $service); - } - - /** - * @covers OAuth\ServiceFactory::createService - * @covers OAuth\ServiceFactory::getFullyQualifiedServiceName - * @covers OAuth\ServiceFactory::buildV2Service - * @covers OAuth\ServiceFactory::resolveScopes - */ - public function testCreateServiceOAuth2RegisteredWithClassConstantsAsScope() - { - $factory = new ServiceFactory(); - - $factory->registerService('foo', '\\OAuthTest\\Mocks\\OAuth2\\Service\\Fake'); - - $service = $factory->createService( - 'foo', - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array('FOO') - ); - - $this->assertInstanceOf('\\OAuth\OAuth2\Service\\ServiceInterface', $service); - $this->assertInstanceOf('\\OAuthTest\\Mocks\\OAuth2\\Service\\Fake', $service); - } - - /** - * @covers OAuth\ServiceFactory::createService - * @covers OAuth\ServiceFactory::getFullyQualifiedServiceName - * @covers OAuth\ServiceFactory::buildV2Service - * @covers OAuth\ServiceFactory::resolveScopes - */ - public function testCreateServiceOAuth2RegisteredWithCustomScope() - { - $factory = new ServiceFactory(); - - $factory->registerService('foo', '\\OAuthTest\\Mocks\\OAuth2\\Service\\Fake'); - - $service = $factory->createService( - 'foo', - $this->getMock('\\OAuth\\Common\\Consumer\\CredentialsInterface'), - $this->getMock('\\OAuth\\Common\\Storage\\TokenStorageInterface'), - array('custom') - ); - - $this->assertInstanceOf('\\OAuth\OAuth2\Service\\ServiceInterface', $service); - $this->assertInstanceOf('\\OAuthTest\\Mocks\\OAuth2\\Service\\Fake', $service); - } -} diff --git a/vendor/lusitanian/oauth/tests/bootstrap.php b/vendor/lusitanian/oauth/tests/bootstrap.php deleted file mode 100644 index 193b857..0000000 --- a/vendor/lusitanian/oauth/tests/bootstrap.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @author David Desberg - * @copyright Copyright (c) 2012 Pieter Hordijk - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ -namespace OAuthTest; - -/** - * Setting up the default timezone. because well... PHP sucks - */ -date_default_timezone_set('Europe/Amsterdam'); - -/** - * Simple SPL autoloader for the OAuthTest mocks - * - * @param string $class The class name to load - * - * @return void - */ -spl_autoload_register(function ($class) { - $nslen = strlen(__NAMESPACE__); - if (substr($class, 0, $nslen) !== __NAMESPACE__) { - return; - } - $path = substr(str_replace('\\', '/', $class), $nslen); - $path = __DIR__ . $path . '.php'; - if (file_exists($path)) { - require $path; - } -}); - -/** - * Fire up the autoloader - */ -require_once __DIR__ . '/../vendor/autoload.php'; From 1c89549888a45e898086adaedd9f8df8439f38a6 Mon Sep 17 00:00:00 2001 From: Tyler Cosgrove Date: Wed, 6 Dec 2017 12:49:05 -0500 Subject: [PATCH 2/3] Migrate to Grav core messages --- classes/Controller.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/classes/Controller.php b/classes/Controller.php index 8e12e03..4b39c98 100644 --- a/classes/Controller.php +++ b/classes/Controller.php @@ -83,6 +83,7 @@ public function execute() { /** @var \Grav\Common\Language\Language */ $t = $this->grav['language']; + $messages = $this->grav['messages']; $provider = strtolower($this->action); $config = $this->grav['config']->get('plugins.login-oauth.providers.' . $this->action, []); @@ -95,7 +96,7 @@ public function execute() $this->service = $this->factory->createService($this->action, $credentials, $this->storage, $scope); } if (!$this->service || empty($config)) { - $this->login->setMessage($t->translate(['PLUGIN_LOGIN_OAUTH.OAUTH_PROVIDER_NOT_SUPPORTED', $this->action])); + $messages->add($t->translate(['PLUGIN_LOGIN_OAUTH.OAUTH_PROVIDER_NOT_SUPPORTED', $this->action])); return true; } @@ -106,9 +107,9 @@ public function execute() if (is_bool($authenticated)) { $this->reset(); if ($authenticated) { - $this->login->setMessage($t->translate('PLUGIN_LOGIN.LOGIN_SUCCESSFUL')); + $messages->add($t->translate('PLUGIN_LOGIN.LOGIN_SUCCESSFUL')); } else { - $this->login->setMessage($t->translate('PLUGIN_LOGIN.ACCESS_DENIED')); + $messages->add($t->translate('PLUGIN_LOGIN.ACCESS_DENIED')); } // Redirect to current URI @@ -118,7 +119,7 @@ public function execute() } $this->setRedirect($redirect); } elseif (!$this->grav['session']->oauth) { - $this->login->setMessage($t->translate(['PLUGIN_LOGIN_OAUTH.OAUTH_PROVIDER_NOT_SUPPORTED', $this->action])); + $messages->add($t->translate(['PLUGIN_LOGIN_OAUTH.OAUTH_PROVIDER_NOT_SUPPORTED', $this->action])); } return true; @@ -241,6 +242,7 @@ public function oauthGoogle() return $this->genericOAuthProvider(function () { /** @var \Grav\Common\Language\Language */ $t = $this->grav['language']; + $messages = $this->grav['messages']; // Get fullname, email and language $data = json_decode($this->service->request('userinfo'), true); @@ -251,7 +253,7 @@ public function oauthGoogle() $domain = isset($data['hd'])?$data['hd']:'gmail.com'; if ( !in_array($domain, $whitelist) ) { - $this->login->setMessage($t->translate(['PLUGIN_LOGIN_OAUTH.EMAIL_DOMAIN_NOT_PERMITTED', $domain])); + $messages->add($t->translate(['PLUGIN_LOGIN_OAUTH.EMAIL_DOMAIN_NOT_PERMITTED', $domain])); return null; } } @@ -261,7 +263,7 @@ public function oauthGoogle() $domain = isset($data['hd'])?$data['hd']:'gmail.com'; if( in_array($domain, $blacklist)) { - $this->login->setMessage($t->translate(['PLUGIN_LOGIN_OAUTH.EMAIL_DOMAIN_NOT_PERMITTED', $domain])); + $messages->add($t->translate(['PLUGIN_LOGIN_OAUTH.EMAIL_DOMAIN_NOT_PERMITTED', $domain])); return null; } } From 9e3b9976f6b86b492d45a90309b43ec541405b4b Mon Sep 17 00:00:00 2001 From: Tyler Cosgrove Date: Wed, 6 Dec 2017 13:28:14 -0500 Subject: [PATCH 3/3] Prepare for release --- CHANGELOG.md | 10 +++++++++- blueprints.yaml | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e4759e..9b4839c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# v1.4.0 +## 12/06/2017 + +1. [](#bugfix) + * Compatibility fixes with Login plugin v2.5.0 - Messages system +1. [](#improved) + * Updated OAuth library to v0.8.10 [#14](https://github.com/getgrav/grav-plugin-login-oauth/issues/14) + # v1.3.1 ## 09/12/2017 @@ -11,7 +19,7 @@ * Added Blacklist and Whitelist support to Google # v1.2.0 -## 12/18/2017 +## 1/18/2017 1. [](#new) * Added LinkedIn provider [#11](https://github.com/getgrav/grav-plugin-login-oauth/pull/11) diff --git a/blueprints.yaml b/blueprints.yaml index 3c1844f..5262f5e 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Login Plugin OAuth Addon -version: 1.3.1 +version: 1.4.0 description: Enables login with OAuth accounts. Currently provides Facebook, Google, Twitter, Github, Linkedin icon: sign-in author: @@ -12,7 +12,7 @@ bugs: https://github.com/getgrav/grav-plugin-login-oauth/issues license: MIT dependencies: - - { name: login, version: '>=2.4.1' } + - { name: login, version: '>=2.5.0' } form: validation: loose