diff options
author | beardyman <nornholdj@gmail.com> | 2015-10-02 16:27:30 -0400 |
---|---|---|
committer | beardyman <nornholdj@gmail.com> | 2015-10-02 16:27:30 -0400 |
commit | 2f1b80397a83f7a6b9863919005dbf384553b3b1 (patch) | |
tree | 22f8be118f0a4d13cdfdc6bb33fec1860214d233 | |
parent | 97e0d2643db1969e299349968eea1d9c7a951d7f (diff) | |
parent | c2e4758d8df8cf7e20451ea3196f2dc918e245e1 (diff) | |
download | php-sparkpost-2f1b80397a83f7a6b9863919005dbf384553b3b1.zip php-sparkpost-2f1b80397a83f7a6b9863919005dbf384553b3b1.tar.gz php-sparkpost-2f1b80397a83f7a6b9863919005dbf384553b3b1.tar.bz2 |
merged master and resolved conflicts
-rw-r--r-- | .coveralls.yml | 9 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .travis.yml | 15 | ||||
-rw-r--r-- | AUTHORS.md | 1 | ||||
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | composer.json | 18 | ||||
-rw-r--r-- | composer.lock | 489 | ||||
-rw-r--r-- | examples/transmission/get_all_transmissions.php | 7 | ||||
-rw-r--r-- | examples/transmission/get_transmission.php | 7 | ||||
-rw-r--r-- | examples/transmission/rfc822.php | 8 | ||||
-rw-r--r-- | examples/transmission/send_transmission_all_fields.php | 8 | ||||
-rw-r--r-- | examples/transmission/simple_send.php | 7 | ||||
-rw-r--r-- | examples/transmission/stored_recipients_inline_content.php | 8 | ||||
-rw-r--r-- | examples/transmission/stored_template_send.php | 8 | ||||
-rw-r--r-- | examples/unwrapped/create_template.php | 8 | ||||
-rw-r--r-- | phpunit.xml | 37 |
16 files changed, 604 insertions, 37 deletions
diff --git a/.coveralls.yml b/.coveralls.yml new file mode 100644 index 0000000..12aed78 --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1,9 @@ +#.coveralls.yml + +src_dir: lib/ + +# single file +coverage_clover: test/output/clover.xml + + +json_path: test/output/coveralls-upload.json @@ -3,3 +3,4 @@ .settings .buildpath test/output/ +examples/example-config.json diff --git a/.travis.yml b/.travis.yml index 445a28e..0547235 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,17 @@ language: php php: -- '5.5' -- '5.6' + - '5.5' + - '5.6' install: -- composer install -script: phpunit --bootstrap test/unit/bootstrap.php ./test/unit + - composer install +before_script: + - curl -s http://getcomposer.org/installer | php + - php composer.phar install --dev --no-interaction +script: + - mkdir -p test/output/report + - composer test +after_script: + - php vendor/bin/coveralls notifications: slack: secure: mw6HF2KR0YwYcIaYvV6qjuWC+XSIP8SQOe13VwmGf3b783hMcZDZTUS9N4bIfpwYi74A9qmzKdc425OSu45nceAf7hzFusCY5rYMoLQK/ksJ7sd+ay7tWhPRuomG1w8idTyXtzce23zOfBtOCHQakbavH2Uz6mh5lJYPFlMKW4c= @@ -4,3 +4,4 @@ php-sparkpost is maintained by Message Systems. * Jordan Nornhold <jordan.norhold@messagesystems.com> * Rich Leland <rich.leland@messagesystems.com>, @richleland +* Matthew April <matthew.japril@gmail.com> @@ -1,4 +1,5 @@ [](https://travis-ci.org/SparkPost/php-sparkpost) +[](https://coveralls.io/github/SparkPost/php-sparkpost?branch=master) # SparkPost PHP SDK The official PHP binding for your favorite SparkPost APIs! @@ -20,6 +21,7 @@ composer require sparkpost/php-sparkpost After installing, you need to require Composer's autoloader: ``` require 'vendor/autoload.php'; +use SparkPost\SparkPost; ``` ## Setting up a Request Adapter @@ -50,6 +52,7 @@ $httpAdapter = new Guzzle6HttpAdapter(new Client()); $sparky = new SparkPost($httpAdapter, ['key'=>'YOUR API KEY']); try { + // Build your email and send it! $results = $sparky->transmission->send([ 'from'=>'From Envelope <from@sparkpostbox.com>', 'html'=>'<html><body><h1>Congratulations, {{name}}!</h1><p>You just sent your very first mailing!</p></body></html>', @@ -120,9 +123,10 @@ try { Run `composer install` inside the directory to install dependecies and development tools. ### Testing -Once all the dependencies are installed, you can execute the unit tests using `vendor/bin/phpunit --bootstrap test/unit/bootstrap.php ./test/unit`. - -If you're interested in code coverage, you can add the `--coverage` flag for phpunit like so: ```phpunit --coverage-html test/output/report --bootstrap test/unit/bootstrap.php ./test/unit``` +Once all the dependencies are installed, you can execute the unit tests using: +``` +composer test +``` ### Contributing 1. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. diff --git a/composer.json b/composer.json index bb27186..a100cde 100644 --- a/composer.json +++ b/composer.json @@ -4,19 +4,25 @@ "license": "Apache 2.0", "version": "0.2.0", "authors": [ - { - "name": "Message Systems, Inc." - } + { + "name": "Message Systems, Inc." + } ], "minimum-stability": "stable", + "scripts": { + "post-install-cmd": "if [ ! -f 'examples/example-config.json' ]; then echo '{\n\t\"api-key\":\"Your API Key\"\n}' >> examples/example-config.json; fi", + "post-update-cmd": "if [ ! -f 'examples/example-config.json' ]; then echo '{\n\t\"api-key\":\"Your API Key\"\n}' >> examples/example-config.json; fi", + "test": "phpunit ./test/unit/" + }, "require": { "php": ">=5.5.0", "egeloen/http-adapter": "*" }, "require-dev": { - "phpunit/phpunit": "4.3.*", - "guzzlehttp/guzzle": "6.*", - "mockery/mockery": "^0.9.4" + "phpunit/phpunit": "4.3.*", + "guzzlehttp/guzzle": "6.*", + "mockery/mockery": "^0.9.4", + "satooshi/php-coveralls": "dev-master" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 7abdd48..da4ff55 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +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": "b0bea9fca01c22325a702a4581b2b1d3", - "content-hash": "5d7c53b1cf6f9ead8f69ba9e3d000a19", + "hash": "3e19d00ab9d875ecad4120ce327766dd", + "content-hash": "781dee6a3f19ff78fcac2dc4814ea1cd", "packages": [ { "name": "egeloen/http-adapter", @@ -241,6 +241,101 @@ "time": "2015-06-14 21:17:01" }, { + "name": "guzzle/guzzle", + "version": "v3.9.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle3.git", + "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9", + "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3.3", + "symfony/event-dispatcher": "~2.1" + }, + "replace": { + "guzzle/batch": "self.version", + "guzzle/cache": "self.version", + "guzzle/common": "self.version", + "guzzle/http": "self.version", + "guzzle/inflection": "self.version", + "guzzle/iterator": "self.version", + "guzzle/log": "self.version", + "guzzle/parser": "self.version", + "guzzle/plugin": "self.version", + "guzzle/plugin-async": "self.version", + "guzzle/plugin-backoff": "self.version", + "guzzle/plugin-cache": "self.version", + "guzzle/plugin-cookie": "self.version", + "guzzle/plugin-curlauth": "self.version", + "guzzle/plugin-error-response": "self.version", + "guzzle/plugin-history": "self.version", + "guzzle/plugin-log": "self.version", + "guzzle/plugin-md5": "self.version", + "guzzle/plugin-mock": "self.version", + "guzzle/plugin-oauth": "self.version", + "guzzle/service": "self.version", + "guzzle/stream": "self.version" + }, + "require-dev": { + "doctrine/cache": "~1.3", + "monolog/monolog": "~1.0", + "phpunit/phpunit": "3.7.*", + "psr/log": "~1.0", + "symfony/class-loader": "~2.1", + "zendframework/zend-cache": "2.*,<2.3", + "zendframework/zend-log": "2.*,<2.3" + }, + "suggest": { + "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.9-dev" + } + }, + "autoload": { + "psr-0": { + "Guzzle": "src/", + "Guzzle\\Tests": "tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Guzzle Community", + "homepage": "https://github.com/guzzle/guzzle/contributors" + } + ], + "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2015-03-18 18:23:50" + }, + { "name": "guzzlehttp/guzzle", "version": "6.1.0", "source": { @@ -835,16 +930,16 @@ }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.7", + "version": "2.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "5e2645ad49d196e020b85598d7c97e482725786a" + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5e2645ad49d196e020b85598d7c97e482725786a", - "reference": "5e2645ad49d196e020b85598d7c97e482725786a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", "shasum": "" }, "require": { @@ -887,7 +982,120 @@ "mock", "xunit" ], - "time": "2015-08-19 09:14:08" + "time": "2015-10-02 06:51:40" + }, + { + "name": "psr/log", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "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", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2012-12-21 11:40:51" + }, + { + "name": "satooshi/php-coveralls", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/satooshi/php-coveralls.git", + "reference": "2fbf803803d179ab1082807308a67bbd5a760c70" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/2fbf803803d179ab1082807308a67bbd5a760c70", + "reference": "2fbf803803d179ab1082807308a67bbd5a760c70", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-simplexml": "*", + "guzzle/guzzle": ">=2.7", + "php": ">=5.3", + "psr/log": "1.0.0", + "symfony/config": ">=2.0", + "symfony/console": ">=2.0", + "symfony/stopwatch": ">=2.2", + "symfony/yaml": ">=2.0" + }, + "require-dev": { + "apigen/apigen": "2.8.*@stable", + "pdepend/pdepend": "dev-master as 2.0.0", + "phpmd/phpmd": "dev-master", + "phpunit/php-invoker": ">=1.1.0,<1.2.0", + "phpunit/phpunit": "3.7.*@stable", + "sebastian/finder-facade": "dev-master", + "sebastian/phpcpd": "1.4.*@stable", + "squizlabs/php_codesniffer": "1.4.*@stable", + "theseer/fdomdocument": "dev-master" + }, + "suggest": { + "symfony/http-kernel": "Allows Symfony integration" + }, + "bin": [ + "composer/bin/coveralls" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.7-dev" + } + }, + "autoload": { + "psr-0": { + "Satooshi\\Component": "src/", + "Satooshi\\Bundle": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kitamura Satoshi", + "email": "with.no.parachute@gmail.com", + "homepage": "https://www.facebook.com/satooshi.jp" + } + ], + "description": "PHP client library for Coveralls API", + "homepage": "https://github.com/satooshi/php-coveralls", + "keywords": [ + "ci", + "coverage", + "github", + "test" + ], + "time": "2014-11-11 15:35:34" }, { "name": "sebastian/comparator", @@ -1210,6 +1418,269 @@ "time": "2015-06-21 13:59:46" }, { + "name": "symfony/config", + "version": "v2.7.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/9698fdf0a750d6887d5e7729d5cf099765b20e61", + "reference": "9698fdf0a750d6887d5e7729d5cf099765b20e61", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/filesystem": "~2.3" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + } + }, + "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 Config Component", + "homepage": "https://symfony.com", + "time": "2015-09-21 15:02:29" + }, + { + "name": "symfony/console", + "version": "v2.7.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "06cb17c013a82f94a3d840682b49425cd00a2161" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/06cb17c013a82f94a3d840682b49425cd00a2161", + "reference": "06cb17c013a82f94a3d840682b49425cd00a2161", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1", + "symfony/phpunit-bridge": "~2.7", + "symfony/process": "~2.1" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + } + }, + "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 Console Component", + "homepage": "https://symfony.com", + "time": "2015-09-25 08:32:23" + }, + { + "name": "symfony/event-dispatcher", + "version": "v2.7.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ae4dcc2a8d3de98bd794167a3ccda1311597c5d9", + "reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "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" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + } + }, + "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": "2015-09-22 13:49:29" + }, + { + "name": "symfony/filesystem", + "version": "v2.7.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/a17f8a17c20e8614c15b8e116e2f4bcde102cfab", + "reference": "a17f8a17c20e8614c15b8e116e2f4bcde102cfab", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + } + }, + "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 Filesystem Component", + "homepage": "https://symfony.com", + "time": "2015-09-09 17:42:36" + }, + { + "name": "symfony/stopwatch", + "version": "v2.7.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "08dd97b3f22ab9ee658cd16e6758f8c3c404336e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/08dd97b3f22ab9ee658cd16e6758f8c3c404336e", + "reference": "08dd97b3f22ab9ee658cd16e6758f8c3c404336e", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + } + }, + "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 Stopwatch Component", + "homepage": "https://symfony.com", + "time": "2015-09-22 13:49:29" + }, + { "name": "symfony/yaml", "version": "v2.7.5", "source": { @@ -1261,7 +1732,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "satooshi/php-coveralls": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/examples/transmission/get_all_transmissions.php b/examples/transmission/get_all_transmissions.php index bc57466..7baf4f1 100644 --- a/examples/transmission/get_all_transmissions.php +++ b/examples/transmission/get_all_transmissions.php @@ -2,13 +2,16 @@ namespace Examples\Transmisson; require_once (dirname(__FILE__).'/../bootstrap.php'); +//pull in API key config +$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json"); +$config = json_decode($configFile, true); + use SparkPost\SparkPost; use GuzzleHttp\Client; use Ivory\HttpAdapter\Guzzle6HttpAdapter; -$key = 'YOUR API KEY'; $httpAdapter = new Guzzle6HttpAdapter(new Client()); -$sparky = new SparkPost($httpAdapter, ['key'=>$key]); +$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]); try { $results = $sparky->transmission->all(); diff --git a/examples/transmission/get_transmission.php b/examples/transmission/get_transmission.php index 9303eca..1e749b9 100644 --- a/examples/transmission/get_transmission.php +++ b/examples/transmission/get_transmission.php @@ -2,13 +2,16 @@ namespace Examples\Transmisson; require_once (dirname(__FILE__).'/../bootstrap.php'); +//pull in API key config +$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json"); +$config = json_decode($configFile, true); + use SparkPost\SparkPost; use GuzzleHttp\Client; use Ivory\HttpAdapter\Guzzle6HttpAdapter; -$key = 'YOUR API KEY'; $httpAdapter = new Guzzle6HttpAdapter(new Client()); -$sparky = new SparkPost($httpAdapter, ['key'=>$key]); +$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]); try { $results = $sparky->transmission->find('Your Transmission ID'); diff --git a/examples/transmission/rfc822.php b/examples/transmission/rfc822.php index 2b10423..b11b34f 100644 --- a/examples/transmission/rfc822.php +++ b/examples/transmission/rfc822.php @@ -1,13 +1,17 @@ <?php namespace Examples\Transmisson; require_once (dirname(__FILE__).'/../bootstrap.php'); + +//pull in API key config +$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json"); +$config = json_decode($configFile, true); + use SparkPost\SparkPost; use GuzzleHttp\Client; use Ivory\HttpAdapter\Guzzle6HttpAdapter; -$key = 'YOUR API KEY'; $httpAdapter = new Guzzle6HttpAdapter(new Client()); -$sparky = new SparkPost($httpAdapter, ['key'=>$key]); +$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]); try { $results = $sparky->transmission->send([ diff --git a/examples/transmission/send_transmission_all_fields.php b/examples/transmission/send_transmission_all_fields.php index ea2a24d..044dcc2 100644 --- a/examples/transmission/send_transmission_all_fields.php +++ b/examples/transmission/send_transmission_all_fields.php @@ -1,13 +1,17 @@ <?php namespace Examples\Transmisson; require_once (dirname(__FILE__).'/../bootstrap.php'); + +//pull in API key config +$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json"); +$config = json_decode($configFile, true); + use SparkPost\SparkPost; use GuzzleHttp\Client; use Ivory\HttpAdapter\Guzzle6HttpAdapter; -$key = 'YOUR API KEY'; $httpAdapter = new Guzzle6HttpAdapter(new Client()); -$sparky = new SparkPost($httpAdapter, ['key'=>$key]); +$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]); try{ $results = $sparky->transmission->send([ diff --git a/examples/transmission/simple_send.php b/examples/transmission/simple_send.php index 34df573..6dc3719 100644 --- a/examples/transmission/simple_send.php +++ b/examples/transmission/simple_send.php @@ -2,13 +2,16 @@ namespace Examples\Transmisson; require_once (dirname(__FILE__).'/../bootstrap.php'); +//pull in API key config +$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json"); +$config = json_decode($configFile, true); + use SparkPost\SparkPost; use GuzzleHttp\Client; use Ivory\HttpAdapter\Guzzle6HttpAdapter; -$key = 'YOUR API KEY'; $httpAdapter = new Guzzle6HttpAdapter(new Client()); -$sparky = new SparkPost($httpAdapter, ['key'=>$key]); +$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]); try { $results = $sparky->transmission->send([ diff --git a/examples/transmission/stored_recipients_inline_content.php b/examples/transmission/stored_recipients_inline_content.php index 9f3a55d..3e53507 100644 --- a/examples/transmission/stored_recipients_inline_content.php +++ b/examples/transmission/stored_recipients_inline_content.php @@ -1,13 +1,17 @@ <?php namespace Examples\Transmisson; require_once (dirname(__FILE__).'/../bootstrap.php'); + +//pull in API key config +$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json"); +$config = json_decode($configFile, true); + use SparkPost\SparkPost; use GuzzleHttp\Client; use Ivory\HttpAdapter\Guzzle6HttpAdapter; -$key = 'YOUR API KEY'; $httpAdapter = new Guzzle6HttpAdapter(new Client()); -$sparky = new SparkPost($httpAdapter, ['key'=>$key]); +$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]); try { diff --git a/examples/transmission/stored_template_send.php b/examples/transmission/stored_template_send.php index 60363ba..936d292 100644 --- a/examples/transmission/stored_template_send.php +++ b/examples/transmission/stored_template_send.php @@ -1,13 +1,17 @@ <?php namespace Examples\Transmisson; require_once (dirname(__FILE__).'/../bootstrap.php'); + +//pull in API key config +$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json"); +$config = json_decode($configFile, true); + use SparkPost\SparkPost; use GuzzleHttp\Client; use Ivory\HttpAdapter\Guzzle6HttpAdapter; -$key = 'YOUR API KEY'; $httpAdapter = new Guzzle6HttpAdapter(new Client()); -$sparky = new SparkPost($httpAdapter, ['key'=>$key]); +$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]); try { $results = $sparky->transmission->send([ diff --git a/examples/unwrapped/create_template.php b/examples/unwrapped/create_template.php index 51ab156..e28f158 100644 --- a/examples/unwrapped/create_template.php +++ b/examples/unwrapped/create_template.php @@ -1,13 +1,17 @@ <?php namespace Examples\Unwrapped; require_once (dirname(__FILE__).'/../bootstrap.php'); + +//pull in API key config +$configFile = file_get_contents(dirname(__FILE__) . "/../example-config.json"); +$config = json_decode($configFile, true); + use SparkPost\SparkPost; use GuzzleHttp\Client; use Ivory\HttpAdapter\Guzzle6HttpAdapter; -$key = 'YOUR API KEY'; $httpAdapter = new Guzzle6HttpAdapter(new Client()); -$sparky = new SparkPost($httpAdapter, ['key'=>$key]); +$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]); try { // define the endpoint diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..3ca0cc3 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,37 @@ +<phpunit + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd" + backupGlobals="true" + backupStaticAttributes="false" + bootstrap="test/unit/bootstrap.php" + cacheTokens="false" + colors="always" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + forceCoversAnnotation="false" + mapTestClassNameToCoveredClassName="false" + printerClass="PHPUnit_TextUI_ResultPrinter" + processIsolation="false" + stopOnError="false" + stopOnFailure="false" + stopOnIncomplete="false" + stopOnSkipped="false" + stopOnRisky="false" + testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader" + timeoutForSmallTests="1" + timeoutForMediumTests="10" + timeoutForLargeTests="60" + verbose="false"> + + + <logging> + <log type="coverage-html" target="test/output/report"/> + <log type="coverage-clover" target="test/output/clover.xml"/> + </logging> + <filter> + <blacklist> + <directory>./vendor</directory> + </blacklist> + </filter> +</phpunit> |