diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..61ead86 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/vendor diff --git a/.travis.yml b/.travis.yml index 3153eab..71328b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,13 @@ language: php php: - 5.3 - 5.4 + - 5.5 + - 5.6 + - hhvm env: - SYMFONY_VERSION="2.1.*" before_script: - wget http://getcomposer.org/composer.phar - - php composer.phar install \ No newline at end of file + - php composer.phar install diff --git a/README.md b/README.md index bfb4699..5832c9d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ -[![Build Status](https://secure.travis-ci.org/phpforce/soap-client.png?branch=master)](http://travis-ci.org/phpforce/soap-client) +[![Build Status](https://travis-ci.org/phpforce/soap-client.svg?branch=master)](https://travis-ci.org/phpforce/soap-client) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/phpforce/soap-client/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phpforce/soap-client/?branch=master) + +###[I’m looking for maintainers!](https://github.com/phpforce/soap-client/issues/4) + PHPForce Soap Client: a PHP client for the Salesforce SOAP API ============================================================== @@ -25,4 +29,104 @@ This library’s features include the following. * Completely unit tested (still working on that one). * Use the client in conjunction with the Symfony2 [Mapper Bundle](https://github.com/ddeboer/DdeboerSalesforceMapperBundle) - to get even easier access to your Salesforce data. \ No newline at end of file + to get even easier access to your Salesforce data. + +Installation +------------ + +This library is available on [Packagist](http://packagist.org/packages/phpforce/soap-client). +The recommended way to install this library is through [Composer](http://getcomposer.org): + +```bash +$ php composer.phar require phpforce/soap-client dev-master +``` + +Usage +----- + +### The client + +Use the client to query and manipulate your organisation’s Salesforce data. First construct a client using the builder: + +```php +$builder = new \Phpforce\SoapClient\ClientBuilder( + '/path/to/your/salesforce/wsdl/sandbox.enterprise.wsdl.xml', + 'username', + 'password', + 'security_token' +); + +$client = $builder->build(); +``` + +### SOQL queries + +```php +$results = $client->query('select Name, SystemModstamp from Account limit 5'); +``` + +This will fetch five accounts from Salesforce and return them as a +`RecordIterator`. You can now iterate over the results. The account’s +`SystemModstamp` is returned as a `\DateTime` object: + +```php +foreach ($results as $account) { + echo 'Last modified: ' . $account->SystemModstamp->format('Y-m-d H:i:') . "\n"; +} +``` + +### One-to-many relations (subqueries) + +Results from [subqueries](http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select.htm) +are themselves returned as record iterators. So: + +```php +$accounts = $client->query( + 'select Id, (select Id, Name from Contacts) from Account limit 10' +); + +foreach ($accounts as $account) { + if (isset($account->Contacts)) { + foreach ($account->Contacts as $contact) { + echo sprintf("Contact %s has name %s\n", $contact->Id, $contact->Name); + } + } +} +``` + +### Fetching large numbers of records + +If you issue a query that returns over 2000 records, only the first 2000 records +will be returned by the Salesforce API. Using the `queryLocator`, you can then +fetch the following results in batches of 2000. The record iterator does this +automatically for you: + +```php +$accounts = $client->query('Select Name from Account'); +echo $accounts->count() . ' accounts returned'; +foreach ($accounts as $account) { + // This will iterate over the 2000 first accounts, then fetch the next 2000 + // and iterate over these, etc. In the end, all your organisations’s accounts + // will be iterated over. +} +``` + +### Logging + +To enable logging for the client, call `withLog()` on the builder. For instance when using [Monolog](https://github.com/Seldaek/monolog): + +```php +$log = new \Monolog\Logger('name'); +$log->pushHandler(new \Monolog\Handler\StreamHandler('path/to/your.log')); + +$builder = new \Phpforce\SoapClient\ClientBuilder( + '/path/to/your/salesforce/wsdl/sandbox.enterprise.wsdl.xml', + 'username', + 'password', + 'security_token' +); +$client = $builder->withLog($log) + ->build(); +``` + +All requests to the Salesforce API, as well as the responses and any errors that it returns, will now be logged. diff --git a/composer.json b/composer.json index 8c250e5..501933c 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "phpforce/soap-client", "type": "library", - "description": "Use the Salesforce SOAP API from PHP", + "description": "A PHP client for the Salesforce SOAP API", "keywords": [ "salesforce", "crm", "soap", "force.com", "web services" ], "license": "MIT", "authors": [ @@ -13,17 +13,20 @@ ], "require": { "php": ">=5.3.0", - "phpforce/common": "dev-master" + "phpforce/common": "dev-master", + "psr/log": "*" }, "require-dev": { - "doctrine/common": "2.3@stable" + "doctrine/common": ">=2.3", + "phpunit/phpunit": "^6.3" }, "suggest": { - "doctrine/common": "For caching SOAP responses" + "doctrine/common": "For caching SOAP responses", + "monolog/monolog": "For logging SOAP transactions" }, "autoload": { "psr-0": { "Phpforce\\SoapClient": "src" } } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..e1e46a2 --- /dev/null +++ b/composer.lock @@ -0,0 +1,2030 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "1628c290f706c8066b83613fdc70058c", + "packages": [ + { + "name": "phpforce/common", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/phpforce/common.git", + "reference": "aa96dfb6b0f43024c95a9d9c88396013e7513f9c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpforce/common/zipball/aa96dfb6b0f43024c95a9d9c88396013e7513f9c", + "reference": "aa96dfb6b0f43024c95a9d9c88396013e7513f9c", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "symfony/event-dispatcher": ">=2.1" + }, + "type": "library", + "autoload": { + "psr-0": { + "Phpforce\\Common": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "David de Boer", + "email": "david@ddeboer.nl", + "homepage": "http://ddeboer.nl" + } + ], + "description": "Common library for the PhpForce Salesforce libraries", + "keywords": [ + "crm", + "force.com", + "salesforce", + "soap", + "web services" + ], + "time": "2014-01-09 10:36:21" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.3.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "67535f1e3fd662bdc68d7ba317c93eecd973617e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/67535f1e3fd662bdc68d7ba317c93eecd973617e", + "reference": "67535f1e3fd662bdc68d7ba317c93eecd973617e", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/dependency-injection": "~3.3", + "symfony/expression-language": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2017-06-09T14:53:08+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/annotations", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "5beebb01b025c94e93686b7a0ed3edae81fe3e7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/5beebb01b025c94e93686b7a0ed3edae81fe3e7f", + "reference": "5beebb01b025c94e93686b7a0ed3edae81fe3e7f", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": "^7.1" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2017-07-22T10:58:02+00:00" + }, + { + "name": "doctrine/cache", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "53d9518ffeb019c51d542ff60cb578f076d3ff16" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/53d9518ffeb019c51d542ff60cb578f076d3ff16", + "reference": "53d9518ffeb019c51d542ff60cb578f076d3ff16", + "shasum": "" + }, + "require": { + "php": "~7.1" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "alcaeus/mongo-php-adapter": "^1.1", + "mongodb/mongodb": "^1.1", + "phpunit/phpunit": "^5.7", + "predis/predis": "~1.0" + }, + "suggest": { + "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2017-07-22T13:00:15+00:00" + }, + { + "name": "doctrine/collections", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/a01ee38fcd999f34d9bfbcee59dbda5105449cbf", + "reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "doctrine/coding-standard": "~0.1@dev", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ], + "time": "2017-07-22T10:37:32+00:00" + }, + { + "name": "doctrine/common", + "version": "v2.8.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "ed349f953d443963c590b008b37b864b8a3c4b21" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/ed349f953d443963c590b008b37b864b8a3c4b21", + "reference": "ed349f953d443963c590b008b37b864b8a3c4b21", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": "~7.1" + }, + "require-dev": { + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ], + "time": "2017-07-22T09:01:43+00:00" + }, + { + "name": "doctrine/inflector", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/e11d84c6e018beedd929cff5220969a3c6d1d462", + "reference": "e11d84c6e018beedd929cff5220969a3c6d1d462", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ], + "time": "2017-07-22T12:18:28+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2017-07-22T11:58:36+00:00" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09T13:34:57+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-04-12T18:52:22+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2017-03-05T18:14:27+00:00" + }, + { + "name": "phar-io/version", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2017-03-05T17:38:23+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-12-27T11:43:31+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "3.2.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/4aada1f93c72c35e22fb1383b47fee43b8f1d157", + "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.3.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-08-08T06:39:58+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fb3933512008d8162b3cdf9e18dba9309b7c3773", + "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2017-06-03T08:32:36+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8 || ^5.6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2017-03-02T20:05:34+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "5.2.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "8ed1902a57849e117b5651fc1a5c48110946c06b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/8ed1902a57849e117b5651fc1a5c48110946c06b", + "reference": "8ed1902a57849e117b5651fc1a5c48110946c06b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.0", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^1.4.11 || ^2.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "ext-xdebug": "^2.5", + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-xdebug": "^2.5.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2017-08-03T12:40:43+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2016-10-03T07:40:28+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2017-02-26T11:10:40+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "ecb0b2cdaa0add708fe6f329ef65ae0c5225130b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/ecb0b2cdaa0add708fe6f329ef65ae0c5225130b", + "reference": "ecb0b2cdaa0add708fe6f329ef65ae0c5225130b", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2017-08-03T14:17:41+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "6.3.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "9501bab711403a1ab5b8378a8adb4ec3db3debdb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9501bab711403a1ab5b8378a8adb4ec3db3debdb", + "reference": "9501bab711403a1ab5b8378a8adb4ec3db3debdb", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.6.1", + "phar-io/manifest": "^1.0.1", + "phar-io/version": "^1.0", + "php": "^7.0", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^5.2.2", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^1.0.9", + "phpunit/phpunit-mock-objects": "^4.0.3", + "sebastian/comparator": "^2.0.2", + "sebastian/diff": "^2.0", + "sebastian/environment": "^3.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-xdebug": "*", + "phpunit/php-invoker": "^1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2017-08-04T05:20:39+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "2f789b59ab89669015ad984afa350c4ec577ade0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/2f789b59ab89669015ad984afa350c4ec577ade0", + "reference": "2f789b59ab89669015ad984afa350c4ec577ade0", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.5", + "php": "^7.0", + "phpunit/php-text-template": "^1.2.1", + "sebastian/exporter": "^3.0" + }, + "conflict": { + "phpunit/phpunit": "<6.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2017-08-03T14:08:16+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "ae068fede81d06e7bb9bb46a367210a3d3e1fe6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/ae068fede81d06e7bb9bb46a367210a3d3e1fe6a", + "reference": "ae068fede81d06e7bb9bb46a367210a3d3e1fe6a", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/diff": "^2.0", + "sebastian/exporter": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2017-08-03T07:14:59+00:00" + }, + { + "name": "sebastian/diff", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2017-08-03T08:09:46+00:00" + }, + { + "name": "sebastian/environment", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2017-07-01T08:51:00+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2017-04-03T13:19:02+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-11-23T20:04:58+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "phpforce/common": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.3.0" + }, + "platform-dev": [] +} diff --git a/src/Phpforce/SoapClient/BulkSaver.php b/src/Phpforce/SoapClient/BulkSaver.php index f1a368e..b34a198 100644 --- a/src/Phpforce/SoapClient/BulkSaver.php +++ b/src/Phpforce/SoapClient/BulkSaver.php @@ -2,8 +2,7 @@ namespace Phpforce\SoapClient; -use Phpforce\SoapClient\Client; -use Phpforce\SoapClient\Response\SaveResult; +use Phpforce\SoapClient\Result\SaveResult; /** * Add creates, updates and upserts to the queue, and issue them in bulk to diff --git a/src/Phpforce/SoapClient/Client.php b/src/Phpforce/SoapClient/Client.php index 1b4143d..de1703b 100644 --- a/src/Phpforce/SoapClient/Client.php +++ b/src/Phpforce/SoapClient/Client.php @@ -658,7 +658,7 @@ protected function createSObject($object, $objectType) foreach (get_object_vars($object) as $field => $value) { $type = $this->soapClient->getSoapElementType($objectType, $field); - if (!$type) { + if ($field != 'Id' && !$type) { continue; } diff --git a/src/Phpforce/SoapClient/ClientBuilder.php b/src/Phpforce/SoapClient/ClientBuilder.php index 8a1a5c4..02ec687 100644 --- a/src/Phpforce/SoapClient/ClientBuilder.php +++ b/src/Phpforce/SoapClient/ClientBuilder.php @@ -3,10 +3,12 @@ use Phpforce\SoapClient\Soap\SoapClientFactory; use Phpforce\SoapClient\Plugin\LogPlugin; -use Phpi\Log\LogInterface; +use Psr\Log\LoggerInterface; /** * Salesforce SOAP client builder + * + * @author David de Boer */ class ClientBuilder { @@ -15,27 +17,29 @@ class ClientBuilder /** * Construct client builder with required parameters * - * @param string $wsdl Path to your Salesforce WSDL - * @param string $username Your Salesforce username - * @param string $password Your Salesforce password - * @param string $token Your Salesforce security token + * @param string $wsdl Path to your Salesforce WSDL + * @param string $username Your Salesforce username + * @param string $password Your Salesforce password + * @param string $token Your Salesforce security token + * @param array $soapOptions Further options to be passed to the SoapClient */ - public function __construct($wsdl, $username, $password, $token) + public function __construct($wsdl, $username, $password, $token, array $soapOptions = array()) { $this->wsdl = $wsdl; $this->username = $username; $this->password = $password; $this->token = $token; + $this->soapOptions = $soapOptions; } /** * Enable logging * - * @param LogInterface $log Logger + * @param LoggerInterface $log Logger * * @return ClientBuilder */ - public function withLog(LogInterface $log) + public function withLog(LoggerInterface $log) { $this->log = $log; @@ -50,7 +54,7 @@ public function withLog(LogInterface $log) public function build() { $soapClientFactory = new SoapClientFactory(); - $soapClient = $soapClientFactory->factory($this->wsdl); + $soapClient = $soapClientFactory->factory($this->wsdl, $this->soapOptions); $client = new Client($soapClient, $this->username, $this->password, $this->token); @@ -62,4 +66,3 @@ public function build() return $client; } } - diff --git a/src/Phpforce/SoapClient/ClientInterface.php b/src/Phpforce/SoapClient/ClientInterface.php index 057363a..ea7d472 100644 --- a/src/Phpforce/SoapClient/ClientInterface.php +++ b/src/Phpforce/SoapClient/ClientInterface.php @@ -235,7 +235,7 @@ public function update(array $objects, $objectType); * @param array $objects Array of objects * @param string $objectType Object type, e.g., account or contact * - * @return Result\SaveResult[] + * @return Result\UpsertResult[] * @link http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_upsert.htm */ public function upsert($externalFieldName, array $objects, $objectType); diff --git a/src/Phpforce/SoapClient/Events.php b/src/Phpforce/SoapClient/Events.php index 21f42c6..6bce079 100644 --- a/src/Phpforce/SoapClient/Events.php +++ b/src/Phpforce/SoapClient/Events.php @@ -3,8 +3,8 @@ final class Events { - const REQUEST = 'php_force.soap_client.request'; - const RESPONSE = 'php_force.soap_client.response'; - const FAULT = 'php_force.soap_client.fault'; + const REQUEST = 'phpforce.soap_client.request'; + const RESPONSE = 'phpforce.soap_client.response'; + const FAULT = 'phpforce.soap_client.fault'; } diff --git a/src/Phpforce/SoapClient/Plugin/LogPlugin.php b/src/Phpforce/SoapClient/Plugin/LogPlugin.php new file mode 100644 index 0000000..54af354 --- /dev/null +++ b/src/Phpforce/SoapClient/Plugin/LogPlugin.php @@ -0,0 +1,64 @@ +logger = $logger; + } + + public function onClientRequest(RequestEvent $event) + { + $this->logger->info(sprintf( + '[phpforce/soap-client] request: call "%s" with params %s', + $event->getMethod(), + \json_encode($event->getParams()) + )); + } + + public function onClientResponse(ResponseEvent $event) + { + $this->logger->info(sprintf( + '[phpforce/soap-client] response: %s', + \print_r($event->getResponse(), true) + )); + } + + public function onClientFault(FaultEvent $event) + { + $this->logger->error(sprintf( + '[phpforce/soap-client] fault "%s" for request "%s" with params %s', + $event->getSoapFault()->getMessage(), + $event->getRequestEvent()->getMethod(), + \json_encode($event->getRequestEvent()->getParams()) + )); + } + + /** + * {@inheritdoc} + */ + public static function getSubscribedEvents() + { + return array( + 'phpforce.soap_client.request' => 'onClientRequest', + 'phpforce.soap_client.response' => 'onClientResponse', + 'phpforce.soap_client.fault' => 'onClientFault' + ); + } +} \ No newline at end of file diff --git a/src/Phpforce/SoapClient/Result/DescribeGlobalResult.php b/src/Phpforce/SoapClient/Result/DescribeGlobalResult.php index c3d5c80..bf67fbd 100644 --- a/src/Phpforce/SoapClient/Result/DescribeGlobalResult.php +++ b/src/Phpforce/SoapClient/Result/DescribeGlobalResult.php @@ -6,5 +6,6 @@ class DescribeGlobalResult { public $encoding; public $maxBatchSize; + /** @var DescribeGlobalSObjectResult[] */ public $sobjects = array(); } \ No newline at end of file diff --git a/src/Phpforce/SoapClient/Result/DescribeSObjectResult.php b/src/Phpforce/SoapClient/Result/DescribeSObjectResult.php index 25e5ae2..cc030df 100644 --- a/src/Phpforce/SoapClient/Result/DescribeSObjectResult.php +++ b/src/Phpforce/SoapClient/Result/DescribeSObjectResult.php @@ -3,6 +3,7 @@ namespace Phpforce\SoapClient\Result; use Doctrine\Common\Collections\ArrayCollection; +use Phpforce\SoapClient\Result\DescribeSObjectResult\Field; class DescribeSObjectResult { @@ -111,7 +112,7 @@ public function isFeedEnabled() /** * - * @return ArrayCollection + * @return ArrayCollection|Field[] */ public function getFields() { diff --git a/src/Phpforce/SoapClient/Result/LoginResult.php b/src/Phpforce/SoapClient/Result/LoginResult.php index 535868f..e987329 100644 --- a/src/Phpforce/SoapClient/Result/LoginResult.php +++ b/src/Phpforce/SoapClient/Result/LoginResult.php @@ -83,7 +83,7 @@ public function getServerInstance() } $match = preg_match( - '/https:\/\/(?[^-\.]+)/', + '/https:\/\/(?[^-]+)\.salesforce\.com/', $this->serverUrl, $matches ); @@ -94,4 +94,4 @@ public function getServerInstance() return $matches['instance']; } -} \ No newline at end of file +} diff --git a/src/Phpforce/SoapClient/Result/SaveResult.php b/src/Phpforce/SoapClient/Result/SaveResult.php index 91ed151..93224a3 100644 --- a/src/Phpforce/SoapClient/Result/SaveResult.php +++ b/src/Phpforce/SoapClient/Result/SaveResult.php @@ -53,7 +53,7 @@ public function isSuccess() } /** - * @return array + * @return Error[] */ public function getErrors() { diff --git a/src/Phpforce/SoapClient/Result/UpsertResult.php b/src/Phpforce/SoapClient/Result/UpsertResult.php index 379708b..34bd359 100644 --- a/src/Phpforce/SoapClient/Result/UpsertResult.php +++ b/src/Phpforce/SoapClient/Result/UpsertResult.php @@ -4,8 +4,18 @@ /** * Upsert result + * + * @see http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_upsert_upsertresult.htm */ class UpsertResult extends SaveResult { + /** + * @var boolean + */ + protected $created; + public function isCreated() + { + return $this->created; + } } \ No newline at end of file diff --git a/src/Phpforce/SoapClient/Soap/SoapClient.php b/src/Phpforce/SoapClient/Soap/SoapClient.php old mode 100644 new mode 100755 index 29f8036..28e9064 --- a/src/Phpforce/SoapClient/Soap/SoapClient.php +++ b/src/Phpforce/SoapClient/Soap/SoapClient.php @@ -42,6 +42,7 @@ public function getSoapTypes() $soapTypes = $this->__getTypes(); foreach ($soapTypes as $soapType) { + $properties = array(); $lines = explode("\n", $soapType); if (!preg_match('/struct (.*) {/', $lines[0], $matches)) { continue; @@ -55,6 +56,12 @@ public function getSoapTypes() preg_match('/\s* (.*) (.*);/', $line, $matches); $properties[$matches[2]] = $matches[1]; } + + // Since every object extends sObject, need to append sObject elements to all native and custom objects + if ($typeName !== 'sObject' && array_key_exists('sObject', $this->types)) { + $properties = array_merge($properties, $this->types['sObject']); + } + $this->types[$typeName] = $properties; } } diff --git a/src/Phpforce/SoapClient/Soap/SoapClientFactory.php b/src/Phpforce/SoapClient/Soap/SoapClientFactory.php index 0bc88b2..9a04d1e 100644 --- a/src/Phpforce/SoapClient/Soap/SoapClientFactory.php +++ b/src/Phpforce/SoapClient/Soap/SoapClientFactory.php @@ -40,30 +40,35 @@ class SoapClientFactory 'SendEmailResult' => 'Phpforce\SoapClient\Result\SendEmailResult', 'SingleEmailMessage' => 'Phpforce\SoapClient\Request\SingleEmailMessage', 'sObject' => 'Phpforce\SoapClient\Result\SObject', - 'UndeleteResult' => 'Phpforce\SoapClient\Result\UndeleteResult' + 'UndeleteResult' => 'Phpforce\SoapClient\Result\UndeleteResult', + 'UpsertResult' => 'Phpforce\SoapClient\Result\UpsertResult', ); /** * Type converters collection * - * @var TypeConverterCollection + * @var TypeConverter\TypeConverterCollection */ protected $typeConverters; /** - * @param string $wsdl Some argument description - * - * @return void + * @param string $wsdl Path to WSDL file + * @param array $soapOptions + * @return SoapClient */ - public function factory($wsdl) + public function factory($wsdl, array $soapOptions = array()) { - return new SoapClient($wsdl, array( - 'trace' => 1, - 'features' => \SOAP_SINGLE_ELEMENT_ARRAYS, - 'classmap' => $this->classmap, - 'typemap' => $this->getTypeConverters()->getTypemap(), + $defaults = array( + 'trace' => 1, + 'features' => \SOAP_SINGLE_ELEMENT_ARRAYS, + 'classmap' => $this->classmap, + 'typemap' => $this->getTypeConverters()->getTypemap(), 'cache_wsdl' => \WSDL_CACHE_MEMORY - )); + ); + + $options = array_merge($defaults, $soapOptions); + + return new SoapClient($wsdl, $options); } /** @@ -80,7 +85,7 @@ public function setClassmapping($soap, $php) /** * Get type converter collection that will be used for the \SoapClient * - * @return TypeConverterCollection + * @return TypeConverter\TypeConverterCollection */ public function getTypeConverters() { @@ -99,7 +104,7 @@ public function getTypeConverters() /** * Set type converter collection * - * @param type $typeConverters Type converter collection + * @param TypeConverter\TypeConverterCollection $typeConverters Type converter collection * * @return SoapClientFactory */ @@ -109,4 +114,4 @@ public function setTypeConverters(TypeConverter\TypeConverterCollection $typeCon return $this; } -} \ No newline at end of file +} diff --git a/tests/Phpforce/SoapClient/Tests/BulkSaverTest.php b/tests/Phpforce/SoapClient/Tests/BulkSaverTest.php index 58d8299..6193ced 100644 --- a/tests/Phpforce/SoapClient/Tests/BulkSaverTest.php +++ b/tests/Phpforce/SoapClient/Tests/BulkSaverTest.php @@ -1,9 +1,11 @@ flush(); } + /** + * @expectedException InvalidArgumentException + */ public function testDeleteWithoutIdThrowsException() { $client = $this->getClient(); $bulkSaver = new BulkSaver($client); $invalidRecord = new \stdClass(); - $this->setExpectedException('\InvalidArgumentException', 'Only records with an Id can be deleted'); $bulkSaver->delete($invalidRecord); } @@ -101,7 +105,9 @@ public function testUpsert() public function testFlushEmpty() { $bulkSaver = new BulkSaver($this->getClient()); - $bulkSaver->flush(); + $result = $bulkSaver->flush(); + + $this->assertEmpty($result); } protected function getClient() diff --git a/tests/Phpforce/SoapClient/Tests/ClientTest.php b/tests/Phpforce/SoapClient/Tests/ClientTest.php index de7ecb6..84d40c7 100644 --- a/tests/Phpforce/SoapClient/Tests/ClientTest.php +++ b/tests/Phpforce/SoapClient/Tests/ClientTest.php @@ -2,6 +2,8 @@ namespace Phpforce\SoapClient\Tests; +use PHPUnit\Framework\TestCase; + use Phpforce\SoapClient\Client; use Phpforce\SoapClient\Request; use Phpforce\SoapClient\Result; @@ -9,7 +11,7 @@ use Phpforce\SoapClient\Result\LoginResult; use \ReflectionClass; -class ClientTest extends \PHPUnit_Framework_TestCase +class ClientTest extends TestCase { public function testDelete() { @@ -56,6 +58,9 @@ public function testQuery() $this->assertEquals(1, $result->count()); } + /** + * @expectedException SoapFault + */ public function testInvalidQueryThrowsSoapFault() { $soapClient = $this->getSoapClient(array('query')); @@ -70,10 +75,12 @@ public function testInvalidQueryThrowsSoapFault() $client = $this->getClient($soapClient); - $this->setExpectedException('\SoapFault'); $client->query('Select NonExistingField from Account'); } + /** + * @expectedException \Phpforce\SoapClient\Exception\SaveException + */ public function testInvalidUpdateResultsInError() { $error = $this->createMock(new Result\Error(), array( @@ -96,7 +103,6 @@ public function testInvalidUpdateResultsInError() ->method('update') ->will($this->returnValue($result)); - $this->setExpectedException('\Phpforce\SoapClient\Exception\SaveException'); $this->getClient($soapClient)->update(array( (object) array( 'Id' => 'invalid-id', @@ -105,10 +111,12 @@ public function testInvalidUpdateResultsInError() ), 'Account'); } + /** + * @expectedException InvalidArgumentException + */ public function testMergeMustThrowException() { $soapClient= $this->getSoapClient(array('merge')); - $this->setExpectedException('\InvalidArgumentException', 'must be an instance of'); $this->getClient($soapClient)->merge(array(new \stdClass), 'Account'); } @@ -137,9 +145,14 @@ public function testMerge() ->method('merge') ->will($this->returnValue($result)); - $this->getClient($soapClient)->merge(array($mergeRequest), 'Account'); + $result = $this->getClient($soapClient)->merge(array($mergeRequest), 'Account'); + + $this->assertEquals(array($mergeResult), $result); } + /** + * @expectedException \Phpforce\SoapClient\Exception\SaveException + */ public function testWithEventDispatcher() { $response = new \stdClass(); @@ -185,15 +198,13 @@ public function testWithEventDispatcher() $dispatcher ->expects($this->at(1)) ->method('dispatch') - ->with('php_force.soap_client.response'); + ->with('phpforce.soap_client.response'); // $dispatcher // ->expects($this->at(2)) // ->method('dispatch') // ->with('php_force.soap_client.error'); - $this->setExpectedException('\Phpforce\SoapClient\Exception\SaveException'); - $client->setEventDispatcher($dispatcher); $client->create(array($c), 'Contact'); } diff --git a/tests/Phpforce/SoapClient/Tests/Soap/SoapClientTest.php b/tests/Phpforce/SoapClient/Tests/Soap/SoapClientTest.php index baa2c52..4d75928 100644 --- a/tests/Phpforce/SoapClient/Tests/Soap/SoapClientTest.php +++ b/tests/Phpforce/SoapClient/Tests/Soap/SoapClientTest.php @@ -1,9 +1,11 @@ add('Phpforce\\SoapClient\\Test', __DIR__); \ No newline at end of file