Subject | Re: [firebird-php] invisible changes to the driver (php 5.5 trunk) |
---|---|
Author | masotti |
Post date | 2011-07-26T09:03:12Z |
Hi Marius,
On 25/07/2011 15:55, marius adrian popa wrote:
> 003 test now passes
> Replace FIELD with CONSTANT (that is the alias returned in Firebird
> stable 2.5.x )
I've seen before that there is no check for FB installed version in PHP
tests.
Other sets skip test if driver version isn't in the expected range.
In environment where both server version are installed (can happen) test
run against 2.5 should run skipping test for previous version and viceversa.
At this point i'd check in test003 if FB version is >= 2.5 and add a new
test (identical to the old one) checking for version < 2.5.
Test is skipped if check fails.
ibase_service_attach() and ibase_server_info() should be tested before
but I don't see a proper test in CVS (searching on line).
Probably should be a function in interbase.inc
Don't know for sure if something like this could work:
In test003.php
--SKIPIF--
<?php
require_once("skipif.inc");
require_once("skipinf2_5.inc");
?>
In skipinf2_5.inc
require_once("interbase.inc");
if (!check_version('2.5', null)) print "skip";
In interbase.inc
// should add an $host global var for service function test
$host = 'localhost';
function check_version($minv, $maxv) {
global $host, $user, $password)
if (!($service = ibase_service_attach($host, $user, $password))
return FALSE;
$implem = ibase_server_info($service, IBASE_SVC_IMPLEMENTATION);
if (stripos($implem, "Firebird")==FALSE)
return FALSE; // Interbase users should provide correct test
$server_info = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
ibase_service_detach($service);
if ( is_set($minv))
$ok_min =
is_set($minv)?
substr($server_info, 4, length($minv) >= $minv : true);
$ok_max =
is_set($maxv)?
substr($server_info, 4, length($maxv) <= $maxv : true);
return ($ok_min && ok_max);
}
Maybe some parentheses must be added/checked.
Just my 0.02 euro.
Ciao.
Mimmo.