Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

Commit

Permalink
Better test.
Browse files Browse the repository at this point in the history
  • Loading branch information
tricky committed Jul 5, 2010
1 parent cea2de5 commit a680697
Showing 1 changed file with 3 additions and 35 deletions.
38 changes: 3 additions & 35 deletions tests/023.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
Resource
--SKIPIF--
<?php
if (!extension_loaded("igbinary")) print "skip\n";
if (!function_exists('curl_init')
&& !function_exists('sqlite_open')) print "skip\n";
?>
if (!extension_loaded("igbinary")) print "skip extenion not loaded\n";
--FILE--
<?php
if(!extension_loaded('igbinary')) {
dl('igbinary.' . PHP_SHLIB_SUFFIX);
}

function test($type, $variable, $test) {
$serialized = igbinary_serialize($variable);
Expand All @@ -22,38 +16,12 @@ function test($type, $variable, $test) {
echo "\n";
}

if (function_exists('curl_init')) {
$test = 'curl';
$res = curl_init('http:https://opensource.dynamoid.com');
} else if (function_exists('sqlite_open')) {
$test = 'sqlite';
$res = sqlite_open('db.txt');
}
$res = tmpfile();

test('resource', $res, false);

switch ($test) {
case 'curl':
curl_close($res);
break;
case 'sqlite':
sqlite_close($res);
@unlink('db.txt');
break;
}
fclose($res);

/*
* you can add regression tests for your extension here
*
* the output of your test code has to be equal to the
* text in the --EXPECT-- section below for the tests
* to pass, differences between the output and the
* expected text are interpreted as failure
*
* see php5/README.TESTING for further information on
* writing regression tests
*/
?>
--EXPECT--
resource
00
Expand Down

0 comments on commit a680697

Please sign in to comment.