Permalink
Browse files

[Common] [BC] Renaming ZendLogAdapter to Zf1LogAdater. Adding a Zf2Lo…

…gAdapter. Renaming ZendCacheAdapter to Zf1CacheAdapter. Adding Zf2CacheAdapter to support Zend Framework 2 caching.

Updating the cache interface to allow passing options to cache methods.
Removing the constructor and removing getCachedObject from CacheAdapterInterface.
Adding a ClosureCacheAdapter.
[Service] Adding the ability to use magic call method behavior for executing commands by name.  Closes #39.
[Tests] Fixing a logging unit test so that it does not spit out to stdout
Separating test dependencies from Guzzle deps by adding a composer-test.json.
Adding unit testing capabilities to the Guzzle phar files.
Updating travis-ci script to use new composer file and adding code coverage to travis runs
[Build] Fixing guzzle-min.phar warning that tried to load index.php
Adding a test-init phing target to help getting setup for testing.
Fixing composer run in travis
  • Loading branch information...
1 parent 5ad66ff commit eabe684b22ba5d1cb59fad96fb976442304ccbc0 @mtdowling mtdowling committed Apr 15, 2012
Showing with 1,548 additions and 315 deletions.
  1. +1 −0 .gitignore
  2. +2 −2 .travis.yml
  3. +20 −5 build.xml
  4. +158 −0 composer-test.json
  5. +9 −52 composer.json
  6. 0 foo
  7. +2 −0 phar-stub-min.php
  8. 0 autoload.php → phar-stub.php
  9. +10 −13 src/Guzzle/Common/Cache/CacheAdapterInterface.php
  10. +70 −0 src/Guzzle/Common/Cache/ClosureCacheAdapter.php
  11. +5 −5 src/Guzzle/Common/Cache/DoctrineCacheAdapter.php
  12. +0 −55 src/Guzzle/Common/Cache/ZendCacheAdapter.php
  13. +51 −0 src/Guzzle/Common/Cache/Zf1CacheAdapter.php
  14. +82 −0 src/Guzzle/Common/Cache/Zf2CacheAdapter.php
  15. +0 −18 src/Guzzle/Common/Log/LogAdapterInterface.php
  16. +1 −7 src/Guzzle/Common/Log/MonologLogAdapter.php
  17. +25 −0 src/Guzzle/Common/Log/Zf1LogAdapter.php
  18. +3 −9 src/Guzzle/Common/Log/{ZendLogAdapter.php → Zf2LogAdapter.php}
  19. +51 −0 src/Guzzle/Service/Client.php
  20. +114 −0 tests/Guzzle/Tests/Common/Cache/ClosureCacheAdapterTest.php
  21. +0 −59 tests/Guzzle/Tests/Common/Cache/ZendCacheAdapterTest.php
  22. +21 −0 tests/Guzzle/Tests/Common/Cache/Zf1CacheAdapterTest.php
  23. +99 −0 tests/Guzzle/Tests/Common/Cache/Zf2CacheAdapterTest.php
  24. +4 −16 tests/Guzzle/Tests/Common/Log/MonologLogAdapterTest.php
  25. +0 −72 tests/Guzzle/Tests/Common/Log/ZendLogAdapterTest.php
  26. +634 −0 tests/Guzzle/Tests/Common/Log/Zend_Log.php
  27. +67 −0 tests/Guzzle/Tests/Common/Log/Zf1LogAdapterTest.php
  28. +65 −0 tests/Guzzle/Tests/Common/Log/Zf2LogAdapterTest.php
  29. +47 −0 tests/Guzzle/Tests/Service/ClientTest.php
  30. +7 −2 tests/bootstrap.php
View
@@ -11,4 +11,5 @@ phpunit.xml
# Ignore composer generated files
composer.lock
+composer-test.lock
vendor/
View
@@ -4,8 +4,8 @@ php:
- 5.4
before_script:
- wget --quiet http://getcomposer.org/composer.phar
- - php composer.phar install --install-suggests
+ - COMPOSER=composer-test.json php composer.phar install
- cp phpunit.xml.dist phpunit.xml
- ~/.nvm/nvm.sh install v0.6.14
- ~/.nvm/nvm.sh run v0.6.14 tests/Guzzle/Tests/Http/server.js &
-script: sudo phpunit
+script: sudo phpunit --coverage-text
View
@@ -1,27 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project name="guzzle" default="phar">
- <target name="phar" description="Create a phar with an autoloader">
+<project name="guzzle" default="package">
+
+ <target name="test-init">
+ <echo message="Updating composer" />
+ <exec command="COMPOSER=composer-test.json composer.phar install" passthru="true" />
+ <copy file="phpunit.xml.dist" tofile="phpunit.xml" overwrite="false" />
+ </target>
+
+ <target name="phar" description="Deprecated phing method name">
+ <phingCall target="package" />
+ </target>
+
+ <target name="package" description="Create a phar with an autoloader">
+ <phingcall target="test-init" />
<if>
<equals arg1="${min}" arg2="true" />
<then>
<pharpackage
destfile="./guzzle-min.phar"
basedir="."
alias="Guzzle"
+ stub="phar-stub-min.php"
signature="md5">
<fileset dir=".">
<include name="src/**/*.php" />
</fileset>
<metadata>
- <element name="version" value="2.0.0" />
+ <element name="author" value="Michael Dowling" />
</metadata>
</pharpackage>
+ <exec command="php -d guzzle_phar=guzzle-min.phar `which phpunit`" passthru="true" />
</then>
<else>
<pharpackage
destfile="./guzzle.phar"
basedir="."
- stub="autoload.php"
+ stub="phar-stub.php"
alias="Guzzle"
signature="md5">
<fileset dir=".">
@@ -33,9 +47,10 @@
<include name="vendor/monolog/monolog/src/**/*.php" />
</fileset>
<metadata>
- <element name="version" value="2.0.0" />
+ <element name="author" value="Michael Dowling" />
</metadata>
</pharpackage>
+ <exec command="php -d guzzle_phar=guzzle.phar `which phpunit`" passthru="true" />
</else>
</if>
</target>
View
@@ -0,0 +1,158 @@
+{
+ "name": "guzzle/guzzle",
+ "type": "library",
+ "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
+ "keywords": ["framework", "http", "rest", "web service", "curl"],
+ "homepage": "http://www.guzzlephp.org/",
+ "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"
+ }
+ ],
+ "repositories": [
+ {
+ "type": "package",
+ "package": {
+ "name": "zend/zend-log",
+ "version": "2.0.0beta3",
+ "dist": {
+ "url": "http://packages.zendframework.com/get/Zend_Log-2.0.0beta3.tgz",
+ "type": "pear"
+ },
+ "autoload": {
+ "psr-0": {
+ "Zend\\Log": "php/"
+ }
+ }
+ }
+ },
+ {
+ "type":"package",
+ "package": {
+ "name": "zend/zend-cache",
+ "version": "2.0.0beta3",
+ "dist": {
+ "url": "http://packages.zendframework.com/get/Zend_Cache-2.0.0beta3.tgz",
+ "type": "pear"
+ },
+ "autoload": {
+ "psr-0": {
+ "Zend\\Cache": "php/"
+ }
+ }
+ }
+ },
+ {
+ "type":"package",
+ "package": {
+ "name": "zend/zend-loader",
+ "version": "2.0.0beta3",
+ "dist": {
+ "url": "http://packages.zendframework.com/get/Zend_Loader-2.0.0beta3.tgz",
+ "type": "pear"
+ },
+ "autoload": {
+ "psr-0": {
+ "Zend\\Loader": "php/"
+ }
+ }
+ }
+ },
+ {
+ "type":"package",
+ "package": {
+ "name": "zend/zend-stdlib",
+ "version": "2.0.0beta3",
+ "dist": {
+ "url": "http://packages.zendframework.com/get/Zend_Stdlib-2.0.0beta3.tgz",
+ "type": "pear"
+ },
+ "autoload": {
+ "psr-0": {
+ "Zend\\Stdlib": "php/"
+ }
+ }
+ }
+ },
+ {
+ "type":"package",
+ "package": {
+ "name": "zend/zend-eventmanager",
+ "version": "2.0.0beta3",
+ "dist": {
+ "url": "http://packages.zendframework.com/get/Zend_EventManager-2.0.0beta3.tgz",
+ "type": "pear"
+ },
+ "autoload": {
+ "psr-0": {
+ "Zend\\EventManager": "php/"
+ }
+ }
+ }
+ },
+ {
+ "type":"package",
+ "package": {
+ "name": "zend/zend-log1",
+ "version": "1.11",
+ "source": {
+ "url": "http://framework.zend.com/svn",
+ "type": "svn",
+ "reference": "framework/standard/trunk/library/Zend/Log/"
+ },
+ "target-dir": "Zend/Log",
+ "autoload": {
+ "psr-0": {
+ "Zend_Log": "/"
+ }
+ }
+ }
+ },
+ {
+ "type":"package",
+ "package": {
+ "name": "zend/zend-cache1",
+ "version": "1.11",
+ "source": {
+ "url": "http://framework.zend.com/svn",
+ "type": "svn",
+ "reference": "framework/standard/trunk/library/Zend/Cache/"
+ },
+ "target-dir": "Zend/Cache",
+ "autoload": {
+ "psr-0": {
+ "Zend_Cache": "/"
+ }
+ }
+ }
+ }
+ ],
+ "require": {
+ "php": ">=5.3.2",
+ "ext-curl": "*",
+ "symfony/event-dispatcher": "*",
+ "symfony/validator": "*",
+ "symfony/class-loader": "*",
+ "monolog/monolog": "*",
+ "zend/zend-cache": "2.0.0beta3",
+ "zend/zend-log": "2.0.0beta3",
+ "zend/zend-loader": "2.0.0beta3",
+ "zend/zend-stdlib": "2.0.0beta3",
+ "zend/zend-eventmanager": "2.0.0beta3",
+ "zend/zend-log1": "1.11",
+ "zend/zend-cache1": "1.11"
+ },
+ "autoload": {
+ "psr-0": {
+ "Guzzle\\Tests": "tests/",
+ "Guzzle": "src/"
+ }
+ }
+}
View
@@ -2,72 +2,29 @@
"name": "guzzle/guzzle",
"type": "library",
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
- "keywords": ["framework", "http", "rest", "web service"],
+ "keywords": ["framework", "http", "rest", "web service", "curl"],
"homepage": "http://www.guzzlephp.org/",
"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"
- }],
- "repositories": [
+ "authors": [
{
- "type": "package",
- "package": {
- "name": "zend/zend-log",
- "version": "2.0.0",
- "autoload": { "psr-0": { "Zend\\Log": "" } },
- "target-dir": "Zend/Log",
- "dist": {
- "url": "https://github.com/KnpLabs/zend-log/zipball/master",
- "type": "zip"
- },
- "source": {
- "url": "https://github.com/KnpLabs/zend-log.git",
- "type": "git",
- "reference": "master"
- }
- }
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
},
{
- "type":"package",
- "package": {
- "name": "zend/zend-cache",
- "version": "2.0.0",
- "autoload": { "psr-0": { "Zend\\Cache": "" } },
- "target-dir": "Zend/Cache",
- "dist": {
- "url": "https://github.com/KnpLabs/zend-cache/zipball/master",
- "type": "zip"
- },
- "source": {
- "url": "https://github.com/KnpLabs/zend-cache.git",
- "type": "git",
- "reference": "master"
- }
- }
+ "name": "Guzzle Community",
+ "homepage": "https://github.com/guzzle/guzzle/contributors"
}
],
"require": {
"php": ">=5.3.2",
"ext-curl": "*",
"symfony/event-dispatcher": "*",
"symfony/validator": "*"
- },
- "suggest": {
- "symfony/class-loader": "*",
- "monolog/monolog": "*",
- "zend/zend-cache": "*",
- "zend/zend-log": "*"
- },
+ }
"autoload": {
"psr-0": {
- "Guzzle\\Tests": "tests/",
"Guzzle": "src/"
}
}
-}
+}
View
0 foo
No changes.
View
@@ -0,0 +1,2 @@
+<?php
+__HALT_COMPILER();
File renamed without changes.
@@ -17,48 +17,45 @@
* Test if an entry exists in the cache.
*
* @param string $id cache id The cache id of the entry to check for.
+ * @param array $options (optional) Array of cache adapter options
*
* @return bool TRUE if a cache entry exists for the given cache id,
* FALSE otherwise.
*/
- function contains($id);
+ function contains($id, array $options = null);
/**
* Deletes a cache entry.
*
* @param string $id cache id
+ * @param array $options (optional) Array of cache adapter options
*
* @return bool TRUE on success, FALSE on failure
*/
- function delete($id);
+ function delete($id, array $options = null);
/**
* Fetches an entry from the cache.
*
* @param string $id cache id The id of the cache entry to fetch.
+ * @param array $options (optional) Array of cache adapter options
*
* @return string The cached data or FALSE, if no cache entry exists
* for the given id.
*/
- function fetch($id);
-
- /**
- * Get the wrapped cache object
- *
- * @return mixed
- */
- function getCacheObject();
+ function fetch($id, array $options = null);
/**
* Puts data into the cache.
*
* @param string $id The cache id.
* @param string $data The cache entry/data.
- * @param int $lifeTime The lifetime. If != false, sets a specific lifetime
- * for this cache entry (null => infinite lifeTime).
+ * @param int $lifeTime The lifetime. If != false, sets a specific
+ * lifetime for this cache entry (null => infinite lifeTime).
+ * @param array $options (optional) Array of cache adapter options
*
* @return bool TRUE if the entry was successfully stored in the cache,
* FALSE otherwise.
*/
- function save($id, $data, $lifeTime = false);
+ function save($id, $data, $lifeTime = false, array $options = null);
}
Oops, something went wrong.

0 comments on commit eabe684

Please sign in to comment.