diff --git a/.travis.yml b/.travis.yml index f48187f5e..6e669d0d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,23 @@ language: php - php: - - 5.4 - - 5.5 - - 5.6 - +- 5.4 +- 5.5 +- 5.6 before_install: - - sudo apt-get update - - sudo apt-get install libcurl4-openssl-dev libjson0-dev - - wget http://s3.amazonaws.com/influxdb/influxdb_latest_amd64.deb - - sudo useradd influxdb - - sudo dpkg -i influxdb_latest_amd64.deb - - sudo cp ./scripts/influxdb_conf.toml /opt/influxdb/shared/config.toml - - travis_retry sudo service influxdb restart - - sudo service influxdb status - +- sudo apt-get update +- sudo apt-get install libcurl4-openssl-dev libjson0-dev +- wget http://s3.amazonaws.com/influxdb/influxdb_latest_amd64.deb +- sudo useradd influxdb +- sudo dpkg -i influxdb_latest_amd64.deb +- sudo cp ./scripts/influxdb_conf.toml /opt/influxdb/shared/config.toml +- travis_retry sudo service influxdb restart +- sudo service influxdb status before_script: - - composer selfupdate - - composer install --prefer-source - +- composer selfupdate +- composer install --prefer-source script: - - vendor/bin/phpspec run -n - - vendor/bin/phpunit +- vendor/bin/phpspec run -n +- vendor/bin/phpunit +notifications: + slack: + secure: UN4V33CfLzEcb+5/LWcfcbwROZobbUawgFSiM3TzagBC+7w0DH2rK8DczxkUBs5rNAaYBj+DkxmmF9tiDb0BLB7Jezlq0vmrNBOhregLodOG44/bFwg58YOwTGxt/Iak38A+8VskGj0sSybNq4TB1/K0040wXS5bA+M/9NqyQeo= diff --git a/VERSION b/VERSION index 0c62199f1..ee1372d33 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.1 +0.2.2 diff --git a/composer.json b/composer.json index 29649d848..9d09071c1 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "Corley\\": ["./benchmarks/"] } }, - "suggests": { + "suggest": { "fabpot/pimple": "Allows to prepare the client dependencies in order to require an initialized instance", "zendframework/zend-servicemanager": "Use a service locator in order to prepare a valid instance", "symfony/dependency-injection": "Prepare a valid instance via the symfony DiC" diff --git a/composer.lock b/composer.lock index 0cfbc69fa..486709c9f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "fef5f885184ca64f876e4cba2d1de5c3", + "hash": "ff63d84450d0ba675f2231b385344e9a", "packages": [ { "name": "guzzlehttp/guzzle", @@ -126,17 +126,17 @@ }, { "name": "zendframework/zend-filter", - "version": "2.3.1", + "version": "2.3.3", "target-dir": "Zend/Filter", "source": { "type": "git", "url": "https://github.com/zendframework/Component_ZendFilter.git", - "reference": "1889b7aa499beccadac770780a73e1a40e0f8a53" + "reference": "98b8c2abfdc9009e4c0157e78c9f22bf2cebb693" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendFilter/zipball/1889b7aa499beccadac770780a73e1a40e0f8a53", - "reference": "1889b7aa499beccadac770780a73e1a40e0f8a53", + "url": "https://api.github.com/repos/zendframework/Component_ZendFilter/zipball/98b8c2abfdc9009e4c0157e78c9f22bf2cebb693", + "reference": "98b8c2abfdc9009e4c0157e78c9f22bf2cebb693", "shasum": "" }, "require": { @@ -171,25 +171,26 @@ "BSD-3-Clause" ], "description": "provides a set of commonly needed data filters", + "homepage": "https://github.com/zendframework/zf2", "keywords": [ "filter", "zf2" ], - "time": "2014-04-15 15:28:47" + "time": "2014-09-16 22:58:11" }, { "name": "zendframework/zend-servicemanager", - "version": "2.3.1", + "version": "2.3.3", "target-dir": "Zend/ServiceManager", "source": { "type": "git", "url": "https://github.com/zendframework/Component_ZendServiceManager.git", - "reference": "652ab6e142b7afd1eede8f0f33b47d2599786c84" + "reference": "559403e4fd10db2516641f20f129a568d7e6a993" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendServiceManager/zipball/652ab6e142b7afd1eede8f0f33b47d2599786c84", - "reference": "652ab6e142b7afd1eede8f0f33b47d2599786c84", + "url": "https://api.github.com/repos/zendframework/Component_ZendServiceManager/zipball/559403e4fd10db2516641f20f129a568d7e6a993", + "reference": "559403e4fd10db2516641f20f129a568d7e6a993", "shasum": "" }, "require": { @@ -217,25 +218,26 @@ "license": [ "BSD-3-Clause" ], + "homepage": "https://github.com/zendframework/zf2", "keywords": [ "servicemanager", "zf2" ], - "time": "2014-04-15 15:28:43" + "time": "2014-09-16 22:58:11" }, { "name": "zendframework/zend-stdlib", - "version": "2.3.1", + "version": "2.3.3", "target-dir": "Zend/Stdlib", "source": { "type": "git", "url": "https://github.com/zendframework/Component_ZendStdlib.git", - "reference": "c1f4830018b5d4f034d32fa01a9e17ea176f56f6" + "reference": "fa33e6647f830d0d2a1cb451efcdfe1bb9a66c33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendStdlib/zipball/c1f4830018b5d4f034d32fa01a9e17ea176f56f6", - "reference": "c1f4830018b5d4f034d32fa01a9e17ea176f56f6", + "url": "https://api.github.com/repos/zendframework/Component_ZendStdlib/zipball/fa33e6647f830d0d2a1cb451efcdfe1bb9a66c33", + "reference": "fa33e6647f830d0d2a1cb451efcdfe1bb9a66c33", "shasum": "" }, "require": { @@ -267,11 +269,12 @@ "license": [ "BSD-3-Clause" ], + "homepage": "https://github.com/zendframework/zf2", "keywords": [ "stdlib", "zf2" ], - "time": "2014-04-15 15:28:48" + "time": "2014-09-16 22:58:11" } ], "packages-dev": [ @@ -327,6 +330,60 @@ ], "time": "2014-06-03 18:32:22" }, + { + "name": "doctrine/instantiator", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "26404e0c90565b614ee76b988b9bc8790d77f590" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/26404e0c90565b614ee76b988b9bc8790d77f590", + "reference": "26404e0c90565b614ee76b988b9bc8790d77f590", + "shasum": "" + }, + "require": { + "php": "~5.3" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "2.0.*@ALPHA" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Instantiator\\": "src" + } + }, + "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": "2014-08-25 15:09:25" + }, { "name": "kevinlebrun/colors.php", "version": "0.2.0", @@ -691,19 +748,20 @@ }, { "name": "phpspec/prophecy", - "version": "v1.2.0", + "version": "v1.2.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "328484c88ed3cd7d1980b624bb98fa635f212ec9" + "reference": "ed9c0bcffe4639a5b0ff83e399eeb28e7fcc68f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/328484c88ed3cd7d1980b624bb98fa635f212ec9", - "reference": "328484c88ed3cd7d1980b624bb98fa635f212ec9", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/ed9c0bcffe4639a5b0ff83e399eeb28e7fcc68f0", + "reference": "ed9c0bcffe4639a5b0ff83e399eeb28e7fcc68f0", "shasum": "" }, "require": { + "doctrine/instantiator": "~1.0,>=1.0.2", "phpdocumentor/reflection-docblock": "~2.0" }, "require-dev": { @@ -745,7 +803,7 @@ "spy", "stub" ], - "time": "2014-07-18 21:26:55" + "time": "2014-09-23 10:52:18" }, { "name": "phpunit/php-code-coverage", @@ -996,16 +1054,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.2.5", + "version": "4.2.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c3abe5953d1e60a0bf23012b1bc8c4d07f4832d7" + "reference": "c28a790620fe30b049bb693be1ef9cd4e0fe906c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c3abe5953d1e60a0bf23012b1bc8c4d07f4832d7", - "reference": "c3abe5953d1e60a0bf23012b1bc8c4d07f4832d7", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c28a790620fe30b049bb693be1ef9cd4e0fe906c", + "reference": "c28a790620fe30b049bb693be1ef9cd4e0fe906c", "shasum": "" }, "require": { @@ -1066,7 +1124,7 @@ "testing", "xunit" ], - "time": "2014-09-06 18:38:27" + "time": "2014-09-14 09:31:24" }, { "name": "phpunit/phpunit-mock-objects", diff --git a/src/InfluxDB/Adapter/GuzzleAdapter.php b/src/InfluxDB/Adapter/GuzzleAdapter.php index 1fa1d35ea..72695edf4 100644 --- a/src/InfluxDB/Adapter/GuzzleAdapter.php +++ b/src/InfluxDB/Adapter/GuzzleAdapter.php @@ -1,5 +1,4 @@ options; } - /** - * @todo Handle timePrecision parameter - */ public function send($message, $timePrecision = false) { $message = json_encode($message); diff --git a/src/InfluxDB/ClientFactory.php b/src/InfluxDB/ClientFactory.php index 035b7f53d..cd94929f6 100644 --- a/src/InfluxDB/ClientFactory.php +++ b/src/InfluxDB/ClientFactory.php @@ -6,20 +6,20 @@ use GuzzleHttp\Client as GuzzleClient; abstract class ClientFactory { - private static $options = [ - "adapter" => [ - "name" => false, - "options" => [], - ], - "options" => [], - "filters" => [ - "query" => false - ], - ]; - public static function create(array $options) { - $options = array_replace_recursive(self::$options, $options); + $defaultOptions = [ + "adapter" => [ + "name" => false, + "options" => [], + ], + "options" => [], + "filters" => [ + "query" => false + ], + ]; + + $options = array_replace_recursive($defaultOptions, $options); $adapterName = $options["adapter"]["name"]; if (!class_exists($adapterName)) { diff --git a/tests/InfluxDB/ClientFactoryTest.php b/tests/InfluxDB/ClientFactoryTest.php index 058de134b..ddaf37898 100644 --- a/tests/InfluxDB/ClientFactoryTest.php +++ b/tests/InfluxDB/ClientFactoryTest.php @@ -3,6 +3,35 @@ namespace InfluxDB; class ClientFactoryTest extends \PHPUnit_Framework_TestCase { + /** + * @group factory + * + * @expectedException InvalidArgumentException + */ + public function testEmptyOptions() + { + $client = ClientFactory::create([]); + } + + /** + * @group factory + */ + public function testDefaultParams() + { + $client = ClientFactory::create(["adapter" => ["name" => "InfluxDB\\Adapter\\GuzzleAdapter"]]); + + $this->assertNull($client->getFilter()); + } + + /** + * @group factory + * @expectedException InvalidArgumentException + */ + public function testInvalidAdapter() + { + $client = ClientFactory::create(["adapter" => ["name" => "UdpAdapter"]]); + } + /** * @group factory * @group udp