From 3e06b670f7a6ff3ee73168c3e83d4c803a745373 Mon Sep 17 00:00:00 2001 From: twalder-docnet Date: Tue, 1 Dec 2015 00:03:36 +0000 Subject: [PATCH] First draft compatibility for the Google API Client 2.0.0 RC2 --- composer.json | 2 +- composer.lock | 752 ++++++++++++++++++++++---- src/GDS/Gateway/GoogleAPIClient.php | 19 +- src/GDS/Mapper/GoogleAPIClientTwo.php | 0 tests/JSONTest.php | 31 +- tests/base/FakeGuzzleClient.php | 48 ++ tests/bootstrap.php | 6 +- 7 files changed, 730 insertions(+), 128 deletions(-) create mode 100644 src/GDS/Mapper/GoogleAPIClientTwo.php create mode 100644 tests/base/FakeGuzzleClient.php diff --git a/composer.json b/composer.json index 6f96c0e..f2414de 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "google/appengine-php-sdk": ">=1.9.22", "phpunit/phpunit": "~4.0", "satooshi/php-coveralls": "dev-master", - "google/apiclient": "1.1.4" + "google/apiclient": "^2.0.0@RC" }, "autoload": { "classmap": [ diff --git a/composer.lock b/composer.lock index 7fab8ee..0cec9c3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "5421306cf8e172aca8d60029bd665895", + "hash": "69b377ddd22b2e41d4ecebb6eee4ed46", + "content-hash": "d32eafd28f6a0e7b0ee85ad9e2ed6d61", "packages": [], "packages-dev": [ { @@ -61,35 +62,89 @@ ], "time": "2015-06-14 21:17:01" }, + { + "name": "firebase/php-jwt", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "time": "2015-07-22 18:31:08" + }, { "name": "google/apiclient", - "version": "1.1.4", + "version": "v2.0.0-RC2", "source": { "type": "git", "url": "https://github.com/google/google-api-php-client.git", - "reference": "2adb5ba90612858d4add0342eee6b8b9aaca398d" + "reference": "3905a254d513236810b2451b1805507782bde313" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/google-api-php-client/zipball/2adb5ba90612858d4add0342eee6b8b9aaca398d", - "reference": "2adb5ba90612858d4add0342eee6b8b9aaca398d", + "url": "https://api.github.com/repos/google/google-api-php-client/zipball/3905a254d513236810b2451b1805507782bde313", + "reference": "3905a254d513236810b2451b1805507782bde313", "shasum": "" }, "require": { - "php": ">=5.2.1" + "firebase/php-jwt": "~2.0|~3.0", + "google/auth": "~0.4", + "guzzlehttp/guzzle": "5.2.*", + "monolog/monolog": "^1.17", + "php": ">=5.4", + "phpseclib/phpseclib": "~2.0" }, "require-dev": { - "phpunit/phpunit": "3.7.*" + "phpunit/phpunit": "~4", + "squizlabs/php_codesniffer": "~2.3", + "symfony/css-selector": "~2.0", + "symfony/dom-crawler": "~2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { + "psr-0": { + "Google_": "src/" + }, "classmap": [ - "src/" + "src/Google/Service/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -101,7 +156,7 @@ "keywords": [ "google" ], - "time": "2015-05-21 19:35:32" + "time": "2015-11-10 04:11:33" }, { "name": "google/appengine-php-sdk", @@ -144,6 +199,51 @@ ], "time": "2015-08-06 04:56:22" }, + { + "name": "google/auth", + "version": "v0.4", + "source": { + "type": "git", + "url": "https://github.com/google/google-auth-library-php.git", + "reference": "b2d0e7bdcbe8ccdd0f83a7527ef23bcc202e331a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/b2d0e7bdcbe8ccdd0f83a7527ef23bcc202e331a", + "reference": "b2d0e7bdcbe8ccdd0f83a7527ef23bcc202e331a", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0", + "guzzlehttp/guzzle": "5.2.*", + "php": ">=5.4" + }, + "require-dev": { + "phplint/phplint": "0.0.1", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ], + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "time": "2015-11-03 23:16:35" + }, { "name": "guzzle/guzzle", "version": "v3.9.3", @@ -239,6 +339,242 @@ ], "time": "2015-03-18 18:23:50" }, + { + "name": "guzzlehttp/guzzle", + "version": "5.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "475b29ccd411f2fa8a408e64576418728c032cfa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/475b29ccd411f2fa8a408e64576418728c032cfa", + "reference": "475b29ccd411f2fa8a408e64576418728c032cfa", + "shasum": "" + }, + "require": { + "guzzlehttp/ringphp": "~1.0", + "php": ">=5.4.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~4.0", + "psr/log": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2015-01-28 01:03:29" + }, + { + "name": "guzzlehttp/ringphp", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/RingPHP.git", + "reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b", + "reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b", + "shasum": "" + }, + "require": { + "guzzlehttp/streams": "~3.0", + "php": ">=5.4.0", + "react/promise": "~2.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "ext-curl": "Guzzle will use specific adapters if cURL is present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Ring\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.", + "time": "2015-05-20 03:37:09" + }, + { + "name": "guzzlehttp/streams", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/streams.git", + "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", + "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Provides a simple abstraction over streams of data", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "Guzzle", + "stream" + ], + "time": "2014-10-12 19:18:40" + }, + { + "name": "monolog/monolog", + "version": "1.17.2", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bee7f0dc9c3e0b69a6039697533dca1e845c8c24", + "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "raven/raven": "^0.13", + "ruflin/elastica": ">=0.90 <3.0", + "swiftmailer/swiftmailer": "~5.3", + "videlalvaro/php-amqplib": "~2.4" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "raven/raven": "Allow sending log messages to a Sentry server", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.16.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2015-10-14 12:51:02" + }, { "name": "phpdocumentor/reflection-docblock", "version": "2.0.4", @@ -288,6 +624,94 @@ ], "time": "2015-02-03 12:10:50" }, + { + "name": "phpseclib/phpseclib", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpseclib/phpseclib.git", + "reference": "a74aa9efbe61430fcb60157c8e025a48ec8ff604" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/a74aa9efbe61430fcb60157c8e025a48ec8ff604", + "reference": "a74aa9efbe61430fcb60157c8e025a48ec8ff604", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phing/phing": "~2.7", + "phpunit/phpunit": "~4.0", + "sami/sami": "~2.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "suggest": { + "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", + "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", + "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", + "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations.", + "pear-pear/PHP_Compat": "Install PHP_Compat to get phpseclib working on PHP < 5.0.0." + }, + "type": "library", + "autoload": { + "psr-4": { + "phpseclib\\": "phpseclib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "phpseclib/" + ], + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jim Wigginton", + "email": "terrafrost@php.net", + "role": "Lead Developer" + }, + { + "name": "Patrick Monnerat", + "email": "pm@datasphere.ch", + "role": "Developer" + }, + { + "name": "Andreas Fischer", + "email": "bantu@phpbb.com", + "role": "Developer" + }, + { + "name": "Hans-Jürgen Petrich", + "email": "petrich@tronic-media.com", + "role": "Developer" + } + ], + "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", + "homepage": "http://phpseclib.sourceforge.net", + "keywords": [ + "BigInteger", + "aes", + "asn.1", + "asn1", + "blowfish", + "crypto", + "cryptography", + "encryption", + "rsa", + "security", + "sftp", + "signature", + "signing", + "ssh", + "twofish", + "x.509", + "x509" + ], + "time": "2015-08-04 04:48:03" + }, { "name": "phpspec/prophecy", "version": "v1.5.0", @@ -350,16 +774,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.2.2", + "version": "2.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c" + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2d7c03c0e4e080901b8f33b2897b0577be18a13c", - "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", "shasum": "" }, "require": { @@ -408,7 +832,7 @@ "testing", "xunit" ], - "time": "2015-08-04 03:42:39" + "time": "2015-10-06 15:47:00" }, { "name": "phpunit/php-file-iterator", @@ -541,16 +965,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.4.6", + "version": "1.4.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b" + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3ab72c62e550370a6cd5dc873e1a04ab57562f5b", - "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", "shasum": "" }, "require": { @@ -586,20 +1010,20 @@ "keywords": [ "tokenizer" ], - "time": "2015-08-16 08:51:00" + "time": "2015-09-15 10:49:45" }, { "name": "phpunit/phpunit", - "version": "4.8.4", + "version": "4.8.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "55bf1d6092b0e13a1f26bd5eaffeef3d8ad85ea7" + "reference": "b2caaf8947aba5e002d42126723e9d69795f32b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/55bf1d6092b0e13a1f26bd5eaffeef3d8ad85ea7", - "reference": "55bf1d6092b0e13a1f26bd5eaffeef3d8ad85ea7", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b2caaf8947aba5e002d42126723e9d69795f32b4", + "reference": "b2caaf8947aba5e002d42126723e9d69795f32b4", "shasum": "" }, "require": { @@ -658,24 +1082,24 @@ "testing", "xunit" ], - "time": "2015-08-15 04:21:23" + "time": "2015-11-30 08:18:59" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.6", + "version": "2.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42" + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/18dfbcb81d05e2296c0bcddd4db96cade75e6f42", - "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", "shasum": "" }, "require": { - "doctrine/instantiator": "~1.0,>=1.0.2", + "doctrine/instantiator": "^1.0.2", "php": ">=5.3.3", "phpunit/php-text-template": "~1.2", "sebastian/exporter": "~1.2" @@ -714,7 +1138,7 @@ "mock", "xunit" ], - "time": "2015-07-10 06:54:24" + "time": "2015-10-02 06:51:40" }, { "name": "psr/log", @@ -754,6 +1178,50 @@ ], "time": "2012-12-21 11:40:51" }, + { + "name": "react/promise", + "version": "v2.2.1", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "3b6fca09c7d56321057fa8867c8dbe1abf648627" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/3b6fca09c7d56321057fa8867c8dbe1abf648627", + "reference": "3b6fca09c7d56321057fa8867c8dbe1abf648627", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "React\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "time": "2015-07-03 13:48:55" + }, { "name": "satooshi/php-coveralls", "version": "dev-master", @@ -1063,16 +1531,16 @@ }, { "name": "sebastian/global-state", - "version": "1.0.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", "shasum": "" }, "require": { @@ -1110,7 +1578,7 @@ "keywords": [ "global state" ], - "time": "2014-10-06 09:23:50" + "time": "2015-10-12 03:26:01" }, { "name": "sebastian/recursion-context", @@ -1202,35 +1670,35 @@ }, { "name": "symfony/config", - "version": "v2.7.3", + "version": "v3.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/Config.git", - "reference": "6c905bbed1e728226de656e4c07d620dfe9e80d9" + "url": "https://github.com/symfony/config.git", + "reference": "40bae8658dbbb500ebc19aa9fde22dc4295fc290" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/6c905bbed1e728226de656e4c07d620dfe9e80d9", - "reference": "6c905bbed1e728226de656e4c07d620dfe9e80d9", + "url": "https://api.github.com/repos/symfony/config/zipball/40bae8658dbbb500ebc19aa9fde22dc4295fc290", + "reference": "40bae8658dbbb500ebc19aa9fde22dc4295fc290", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/filesystem": "~2.3" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" + "php": ">=5.5.9", + "symfony/filesystem": "~2.8|~3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Config\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1248,30 +1716,30 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2015-07-09 16:07:40" + "time": "2015-11-02 20:34:04" }, { "name": "symfony/console", - "version": "v2.7.3", + "version": "v3.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/Console.git", - "reference": "d6cf02fe73634c96677e428f840704bfbcaec29e" + "url": "https://github.com/symfony/console.git", + "reference": "175871ca8d1ef16ff8d8cac395a1c73afa8d0e63" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/d6cf02fe73634c96677e428f840704bfbcaec29e", - "reference": "d6cf02fe73634c96677e428f840704bfbcaec29e", + "url": "https://api.github.com/repos/symfony/console/zipball/175871ca8d1ef16ff8d8cac395a1c73afa8d0e63", + "reference": "175871ca8d1ef16ff8d8cac395a1c73afa8d0e63", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1", - "symfony/phpunit-bridge": "~2.7", - "symfony/process": "~2.1" + "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0" }, "suggest": { "psr/log": "For using the console logger", @@ -1281,13 +1749,16 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Console\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1305,20 +1776,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2015-07-28 15:18:12" + "time": "2015-11-30 12:36:17" }, { "name": "symfony/event-dispatcher", - "version": "v2.7.3", + "version": "v2.8.0", "source": { "type": "git", - "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "9310b5f9a87ec2ea75d20fec0b0017c77c66dac3" + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/9310b5f9a87ec2ea75d20fec0b0017c77c66dac3", - "reference": "9310b5f9a87ec2ea75d20fec0b0017c77c66dac3", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a5eb815363c0388e83247e7e9853e5dbc14999cc", + "reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc", "shasum": "" }, "require": { @@ -1326,11 +1797,10 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5", - "symfony/dependency-injection": "~2.6", - "symfony/expression-language": "~2.6", - "symfony/phpunit-bridge": "~2.7", - "symfony/stopwatch": "~2.3" + "symfony/config": "~2.0,>=2.0.5|~3.0.0", + "symfony/dependency-injection": "~2.6|~3.0.0", + "symfony/expression-language": "~2.6|~3.0.0", + "symfony/stopwatch": "~2.3|~3.0.0" }, "suggest": { "symfony/dependency-injection": "", @@ -1339,13 +1809,16 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "2.8-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1363,38 +1836,38 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2015-06-18 19:21:56" + "time": "2015-10-30 20:15:42" }, { "name": "symfony/filesystem", - "version": "v2.7.3", + "version": "v3.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/Filesystem.git", - "reference": "2d7b2ddaf3f548f4292df49a99d19c853d43f0b8" + "url": "https://github.com/symfony/filesystem.git", + "reference": "692d98d813e4ef314b9c22775c86ddbeb0f44884" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/2d7b2ddaf3f548f4292df49a99d19c853d43f0b8", - "reference": "2d7b2ddaf3f548f4292df49a99d19c853d43f0b8", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/692d98d813e4ef314b9c22775c86ddbeb0f44884", + "reference": "692d98d813e4ef314b9c22775c86ddbeb0f44884", "shasum": "" }, "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" + "php": ">=5.5.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1412,38 +1885,94 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2015-07-09 16:07:40" + "time": "2015-11-23 10:41:47" }, { - "name": "symfony/stopwatch", - "version": "v2.7.3", + "name": "symfony/polyfill-mbstring", + "version": "v1.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/Stopwatch.git", - "reference": "b07a866719bbac5294c67773340f97b871733310" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "0b6a8940385311a24e060ec1fe35680e17c74497" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/b07a866719bbac5294c67773340f97b871733310", - "reference": "b07a866719bbac5294c67773340f97b871733310", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0b6a8940385311a24e060ec1fe35680e17c74497", + "reference": "0b6a8940385311a24e060ec1fe35680e17c74497", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.3.3" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2015-11-04 20:28:58" + }, + { + "name": "symfony/stopwatch", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "6aeac8907e3e1340a0033b0a9ec075f8e6524800" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/6aeac8907e3e1340a0033b0a9ec075f8e6524800", + "reference": "6aeac8907e3e1340a0033b0a9ec075f8e6524800", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Stopwatch\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1461,38 +1990,38 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2015-07-01 18:23:16" + "time": "2015-10-30 23:35:59" }, { "name": "symfony/yaml", - "version": "v2.7.3", + "version": "v3.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "71340e996171474a53f3d29111d046be4ad8a0ff" + "url": "https://github.com/symfony/yaml.git", + "reference": "177a015cb0e19ff4a49e0e2e2c5fc1c1bee07002" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/71340e996171474a53f3d29111d046be4ad8a0ff", - "reference": "71340e996171474a53f3d29111d046be4ad8a0ff", + "url": "https://api.github.com/repos/symfony/yaml/zipball/177a015cb0e19ff4a49e0e2e2c5fc1c1bee07002", + "reference": "177a015cb0e19ff4a49e0e2e2c5fc1c1bee07002", "shasum": "" }, "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" + "php": ">=5.5.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.0-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1510,13 +2039,14 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-07-28 14:07:07" + "time": "2015-11-30 12:36:17" } ], "aliases": [], "minimum-stability": "stable", "stability-flags": { - "satooshi/php-coveralls": 20 + "satooshi/php-coveralls": 20, + "google/apiclient": 5 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/src/GDS/Gateway/GoogleAPIClient.php b/src/GDS/Gateway/GoogleAPIClient.php index cbb8cae..2908d40 100644 --- a/src/GDS/Gateway/GoogleAPIClient.php +++ b/src/GDS/Gateway/GoogleAPIClient.php @@ -62,6 +62,9 @@ public function __construct(\Google_Client $obj_client, $str_dataset_id, $str_na public static function createGoogleClient($str_app_name, $str_service_account, $str_key_file) { $obj_client = new \Google_Client(); + if('2' === $obj_client->getLibraryVersion()[0]) { + throw new \RuntimeException("Not supported with Google API 2"); + } $obj_client->setApplicationName($str_app_name); $str_key = file_get_contents($str_key_file); $obj_client->setAssertionCredentials( @@ -85,12 +88,16 @@ public static function createGoogleClient($str_app_name, $str_service_account, $ public static function createClientFromJson($str_json_file) { $obj_client = new \Google_Client(); - $obj_client->setAssertionCredentials($obj_client->loadServiceAccountJson( - $str_json_file, - [\Google_Service_Datastore::DATASTORE, \Google_Service_Datastore::USERINFO_EMAIL] - )); - // App Engine php55 runtime dev server problems... - $obj_client->setClassConfig('Google_Http_Request', 'disable_gzip', TRUE); + if('2' === $obj_client->getLibraryVersion()[0]) { + $obj_client->setAuthConfig($str_json_file); + } else { + $obj_client->setAssertionCredentials($obj_client->loadServiceAccountJson( + $str_json_file, + [\Google_Service_Datastore::DATASTORE, \Google_Service_Datastore::USERINFO_EMAIL] + )); + // App Engine php55 runtime dev server problems... + $obj_client->setClassConfig('Google_Http_Request', 'disable_gzip', TRUE); + } return $obj_client; } diff --git a/src/GDS/Mapper/GoogleAPIClientTwo.php b/src/GDS/Mapper/GoogleAPIClientTwo.php new file mode 100644 index 0000000..e69de29 diff --git a/tests/JSONTest.php b/tests/JSONTest.php index 35f4f00..5818384 100644 --- a/tests/JSONTest.php +++ b/tests/JSONTest.php @@ -24,7 +24,7 @@ class JSONTest extends \PHPUnit_Framework_TestCase { /** - * @var \Google_IO_Fake + * @var object */ private $obj_fake_io = null; @@ -36,8 +36,13 @@ class JSONTest extends \PHPUnit_Framework_TestCase private function setupTestClient() { $obj_client = new \Google_Client(); - $this->obj_fake_io = new Google_IO_Fake($obj_client); - $obj_client->setIo($this->obj_fake_io); + if('2' === $obj_client->getLibraryVersion()[0]) { + $this->obj_fake_io = new FakeGuzzleClient(); + $obj_client->setHttpClient($this->obj_fake_io); + } else { + $this->obj_fake_io = new Google_IO_Fake($obj_client); + $obj_client->setIo($this->obj_fake_io); + } return $obj_client; } @@ -46,6 +51,7 @@ private function setupTestClient() * * @param $str_url * @param $str_req + * @param string $str_response */ private function expectRequest($str_url, $str_req, $str_response = '{}') { @@ -57,6 +63,9 @@ private function expectRequest($str_url, $str_req, $str_response = '{}') */ public function testCreateClient() { + if(substr(Google_Client::LIBVER, 0, 1) === '2') { + return; + } $obj_client = \GDS\Gateway\GoogleAPIClient::createGoogleClient('test-app', 'test@example.com', dirname(__FILE__) . '/base/test.p12'); $this->assertInstanceOf('\\Google_Client', $obj_client); $this->assertInstanceOf('\\Google_Auth_OAuth2', $obj_client->getAuth()); @@ -67,9 +76,15 @@ public function testCreateClient() */ public function testCreateClientFromJSON() { - $obj_client = \GDS\Gateway\GoogleAPIClient::createClientFromJson(dirname(__FILE__) . '/base/service.json'); + $obj_client = $this->createAPIClient(); $this->assertInstanceOf('\\Google_Client', $obj_client); - $this->assertInstanceOf('\\Google_Auth_OAuth2', $obj_client->getAuth()); + // $this->assertInstanceOf('\\Google_Auth_OAuth2', $obj_client->getAuth()); + } + + private function createAPIClient() + { + $obj_client = \GDS\Gateway\GoogleAPIClient::createClientFromJson(dirname(__FILE__) . '/base/service.json'); + return $obj_client; } /** @@ -77,7 +92,7 @@ public function testCreateClientFromJSON() */ public function testCreateGateway() { - $obj_client = GDS\Gateway\GoogleAPIClient::createClientFromJson(dirname(__FILE__) . '/base/service.json'); + $obj_client = $this->createAPIClient(); $obj_gateway = new GDS\Gateway\GoogleAPIClient($obj_client, 'Dataset'); $this->assertInstanceOf('\\GDS\\Gateway\\GoogleAPIClient', $obj_gateway); } @@ -182,7 +197,7 @@ public function testBeginAndUseTransactionRequest() $obj_store = new \GDS\Store('Book', $obj_gateway); $this->expectRequest( 'https://www.googleapis.com/datastore/v1beta2/datasets/Dataset/beginTransaction', - '{}', + '[]', '{"transaction":"EeDoHGJsLR4eGjkABRmGMYV-Vj6Gtwn3ayLOvPX8ccUzuR4NZG0MMhmD28O-3gTTwdIUINZeJBk22kubBQPd0-Nz1sY="}' ); $obj_store->beginTransaction(); @@ -432,7 +447,7 @@ public function testUpsertWithKeyNameInTransactionRequest() $this->expectRequest( 'https://www.googleapis.com/datastore/v1beta2/datasets/Dataset/beginTransaction', - '{}', + '[]', '{"transaction":"EeDoHGJsLR4eGjkABRmGMYV-Vj6Gtwn3ayLOvPX8ccUzuR4NZG0MMhmD28O-3gTTwdIUINZeJBk22kubBQPd0-Nz1sY="}' ); $obj_store->beginTransaction(); diff --git a/tests/base/FakeGuzzleClient.php b/tests/base/FakeGuzzleClient.php new file mode 100644 index 0000000..10e8859 --- /dev/null +++ b/tests/base/FakeGuzzleClient.php @@ -0,0 +1,48 @@ +str_request_body_for_testing, $request->getBody()->__toString()); + PHPUnit_Framework_Assert::assertEquals($this->str_request_url_for_testing, $request->getUrl()); + return new \GuzzleHttp\Message\Response(200, [], \GuzzleHttp\Stream\Stream::factory($this->str_expected_response)); + } + + /** + * Set up the expected request and response strings + * + * @param $str_url + * @param $str_req + * @param $str_response + */ + public function expectRequest($str_url, $str_req, $str_response) + { + $this->str_request_url_for_testing = $str_url; + $this->str_request_body_for_testing = $str_req; + $this->str_expected_response = $str_response; + } + +} \ No newline at end of file diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 71b924f..79ae9c0 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -15,5 +15,7 @@ require_once(dirname(__FILE__) . '/base/GDSTest.php'); require_once(dirname(__FILE__) . '/base/Simple.php'); require_once(dirname(__FILE__) . '/base/Book.php'); -require_once(dirname(__FILE__) . '/base/Google_IO_Fake.php'); -require_once(dirname(__FILE__) . '/base/DenyGQLProxyMock.php'); \ No newline at end of file +//require_once(dirname(__FILE__) . '/base/Google_IO_Fake.php'); +require_once(dirname(__FILE__) . '/base/FakeGuzzleClient.php'); +require_once(dirname(__FILE__) . '/base/DenyGQLProxyMock.php'); +