Skip to content

Commit

Permalink
Updated the caching tests and added support for CloudFusion::delete_c…
Browse files Browse the repository at this point in the history
…ache_response().
  • Loading branch information
Ryan Parman committed Oct 11, 2009
1 parent a67d3cb commit f35c5bd
Show file tree
Hide file tree
Showing 16 changed files with 223 additions and 67 deletions.
Binary file modified _tests/_cache/sqlite.db
Binary file not shown.
8 changes: 4 additions & 4 deletions _tests/cloudfusion/cache_response_apc.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ AmazonSDB::cache_response CacheAPC

// First time pulls live data
$response = $sdb->cache_response('list_domains', 'apc', 10);
var_dump($response->status);
var_dump($response->isOK());

// Second time pulls from cache
$response = $sdb->cache_response('list_domains', 'apc', 10);
var_dump($response->status);
var_dump($response->isOK());
?>

--EXPECT--
int(200)
int(200)
bool(true)
bool(true)
8 changes: 4 additions & 4 deletions _tests/cloudfusion/cache_response_apc2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ AmazonSDB::cache_response CacheAPC

// First time pulls live data
$response = $sdb->cache_response('list_domains', 'apc', 2);
var_dump($response->status);
var_dump($response->isOK());

sleep(2);

// Second time pulls from cache
$response = $sdb->cache_response('list_domains', 'apc', 2);
var_dump($response->status);
var_dump($response->isOK());
?>

--EXPECT--
int(200)
int(200)
bool(true)
bool(true)
13 changes: 4 additions & 9 deletions _tests/cloudfusion/cache_response_file.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@ AmazonSDB::cache_response CacheFile

// First time pulls live data
$response = $sdb->cache_response('list_domains', dirname(dirname(__FILE__)) . '/_cache', 10);
var_dump($response->status);
var_dump($response->isOK());

// Second time pulls from cache
$response = $sdb->cache_response('list_domains', dirname(dirname(__FILE__)) . '/_cache', 10);
var_dump($response->status);
var_dump($response->isOK());
?>

--EXPECT--
int(200)
int(200)

--CLEAN--
<?php

?>
bool(true)
bool(true)
13 changes: 4 additions & 9 deletions _tests/cloudfusion/cache_response_file2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,15 @@ AmazonSDB::cache_response CacheFile

// First time pulls live data
$response = $sdb->cache_response('list_domains', dirname(dirname(__FILE__)) . '/_cache', 2);
var_dump($response->status);
var_dump($response->isOK());

sleep(2);

// Second time pulls from cache
$response = $sdb->cache_response('list_domains', dirname(dirname(__FILE__)) . '/_cache', 2);
var_dump($response->status);
var_dump($response->isOK());
?>

--EXPECT--
int(200)
int(200)

--CLEAN--
<?php

?>
bool(true)
bool(true)
8 changes: 4 additions & 4 deletions _tests/cloudfusion/cache_response_memcached.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ AmazonSDB::cache_response CacheMC
$response = $sdb->cache_response('list_domains', array(
array('host' => '127.0.0.1')
), 10);
var_dump($response->status);
var_dump($response->isOK());

// Second time pulls from cache
$response = $sdb->cache_response('list_domains', array(
array('host' => '127.0.0.1')
), 10);
var_dump($response->status);
var_dump($response->isOK());
?>

--EXPECT--
int(200)
int(200)
bool(true)
bool(true)
16 changes: 8 additions & 8 deletions _tests/cloudfusion/cache_response_multi_apc.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ AmazonSDB::cache_response MultiCurl CacheAPC

// First time pulls live data
$response = $sdb->cache_response(array($http, 'send_multi_request'), 'apc', 60, array($handles));
var_dump($response[0]->status);
var_dump($response[1]->status);
var_dump($response[0]->isOK());
var_dump($response[1]->isOK());

// Second time pulls from cache
$response = $sdb->cache_response(array($http, 'send_multi_request'), 'apc', 60, array($handles));
var_dump($response[0]->status);
var_dump($response[1]->status);
var_dump($response[0]->isOK());
var_dump($response[1]->isOK());
?>

--EXPECT--
int(200)
int(200)
int(200)
int(200)
bool(true)
bool(true)
bool(true)
bool(true)
16 changes: 8 additions & 8 deletions _tests/cloudfusion/cache_response_multi_apc2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ AmazonSDB::cache_response MultiCurl CacheAPC

// First time pulls live data
$response = $sdb->cache_response(array($http, 'send_multi_request'), 'apc', 2, array($handles));
var_dump($response[0]->status);
var_dump($response[1]->status);
var_dump($response[0]->isOK());
var_dump($response[1]->isOK());

sleep(2);

// Second time pulls from cache
$response = $sdb->cache_response(array($http, 'send_multi_request'), 'apc', 2, array($handles));
var_dump($response[0]->status);
var_dump($response[1]->status);
var_dump($response[0]->isOK());
var_dump($response[1]->isOK());
?>

--EXPECT--
int(200)
int(200)
int(200)
int(200)
bool(true)
bool(true)
bool(true)
bool(true)
16 changes: 8 additions & 8 deletions _tests/cloudfusion/cache_response_multi_file.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ AmazonSDB::cache_response MultiCurl CacheFile

// First time pulls live data
$response = $sdb->cache_response(array($http, 'send_multi_request'), dirname(dirname(__FILE__)) . '/_cache', 60, array($handles));
var_dump($response[0]->status);
var_dump($response[1]->status);
var_dump($response[0]->isOK());
var_dump($response[1]->isOK());

// Second time pulls from cache
$response = $sdb->cache_response(array($http, 'send_multi_request'), dirname(dirname(__FILE__)) . '/_cache', 60, array($handles));
var_dump($response[0]->status);
var_dump($response[1]->status);
var_dump($response[0]->isOK());
var_dump($response[1]->isOK());
?>

--EXPECT--
int(200)
int(200)
int(200)
int(200)
bool(true)
bool(true)
bool(true)
bool(true)
16 changes: 8 additions & 8 deletions _tests/cloudfusion/cache_response_multi_file2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ AmazonSDB::cache_response MultiCurl CacheFile

// First time pulls live data
$response = $sdb->cache_response(array($http, 'send_multi_request'), dirname(dirname(__FILE__)) . '/_cache', 2, array($handles));
var_dump($response[0]->status);
var_dump($response[1]->status);
var_dump($response[0]->isOK());
var_dump($response[1]->isOK());

sleep(2);

// Second time pulls from cache
$response = $sdb->cache_response(array($http, 'send_multi_request'), dirname(dirname(__FILE__)) . '/_cache', 2, array($handles));
var_dump($response[0]->status);
var_dump($response[1]->status);
var_dump($response[0]->isOK());
var_dump($response[1]->isOK());
?>

--EXPECT--
int(200)
int(200)
int(200)
int(200)
bool(true)
bool(true)
bool(true)
bool(true)
8 changes: 4 additions & 4 deletions _tests/cloudfusion/cache_response_pdo_sqlite.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ AmazonSDB::cache_response CachePDO:SQLite

// First time pulls live data
$response = $sdb->cache_response('list_domains', 'pdo.sqlite:' . dirname(dirname(__FILE__)) . '/_cache/sqlite.db', 10);
var_dump($response->status);
var_dump($response->isOK());

// Second time pulls from cache
$response = $sdb->cache_response('list_domains', 'pdo.sqlite:' . dirname(dirname(__FILE__)) . '/_cache/sqlite.db', 10);
var_dump($response->status);
var_dump($response->isOK());
?>

--EXPECT--
int(200)
int(200)
bool(true)
bool(true)
18 changes: 18 additions & 0 deletions _tests/cloudfusion/delete_cache_response_apc.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
AmazonSDB::delete_cache_response CacheAPC

--FILE--
<?php
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';

// Instantiate
$sdb = new AmazonSDB();

// Delete the data
$response = $sdb->delete_cache_response('list_domains', 'apc');
var_dump($response);
?>

--EXPECT--
bool(false)
18 changes: 18 additions & 0 deletions _tests/cloudfusion/delete_cache_response_file.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
AmazonSDB::delete_cache_response CacheFile

--FILE--
<?php
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';

// Instantiate
$sdb = new AmazonSDB();

// Delete the data
$response = $sdb->delete_cache_response('list_domains', dirname(dirname(__FILE__)) . '/_cache');
var_dump($response);
?>

--EXPECT--
bool(true)
26 changes: 26 additions & 0 deletions _tests/cloudfusion/delete_cache_response_memcached.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--TEST--
AmazonSDB::delete_cache_response CacheMC

--SKIPIF--
<?php
if (!method_exists('Memcache', 'connect')) print 'skip Memcached extension not available';
elseif (!Memcache::connect('127.0.0.1')) print 'skip Memcached cannot connect to server';
?>

--FILE--
<?php
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';

// Instantiate
$sdb = new AmazonSDB();

// Delete the data
$response = $sdb->delete_cache_response('list_domains', array(
array('host' => '127.0.0.1')
));
var_dump($response);
?>

--EXPECT--
bool(true)
18 changes: 18 additions & 0 deletions _tests/cloudfusion/delete_cache_response_pdo_sqlite.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
AmazonSDB::delete_cache_response CachePDO:SQLite

--FILE--
<?php
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';

// Instantiate
$sdb = new AmazonSDB();

// Delete the data
$response = $sdb->delete_cache_response('list_domains', 'pdo.sqlite:' . dirname(dirname(__FILE__)) . '/_cache/sqlite.db');
var_dump($response);
?>

--EXPECT--
bool(true)
Loading

0 comments on commit f35c5bd

Please sign in to comment.