Skip to content

Commit

Permalink
Modify session testing logic
Browse files Browse the repository at this point in the history
In the event that the test PHP executable has been built with redis
and/or igbinary support built statically, we don't need to try and
find it by adding --no-php-ini and the extension directives themselves.

This fixes the test execution when php has the required extensions
already.
  • Loading branch information
michael-grunder committed Sep 21, 2018
1 parent 2f694e1 commit bfd2747
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions tests/RedisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5663,9 +5663,27 @@ private function getPhpCommand($script)

if (!$cmd) {
$cmd = (getenv('TEST_PHP_EXECUTABLE') ?: (defined('PHP_BINARY') ? PHP_BINARY : 'php')); // PHP_BINARY is 5.4+
$cmd .= ' ';
$cmd .= (getenv('TEST_PHP_ARGS') ?: '--no-php-ini --define extension=igbinary.so --define extension=' . dirname(__DIR__) . '/modules/redis.so');

if ($test_args = getenv('TEST_PHP_ARGS')) {
$cmd .= $test_args;

This comment has been minimized.

Copy link
@remicollet

remicollet Oct 12, 2018

Collaborator

Missing space between command and args.

} else {
/* Only append specific extension directives if PHP hasn't been compiled with what we need statically */
$result = shell_exec("$cmd --no-php-ini -m");
$redis = strpos($result, 'redis') !== false;
$igbinary = strpos($result, 'igbinary') !== false;

if (!$redis || !$igbinary) {
$cmd .= ' --no-php-ini';
if (!$igbinary) {
$cmd .= ' --define extension=igbinary.so';
}
if (!$redis) {
$cmd .= ' --define extension=' . dirname(__DIR__) . '/modules/redis.so';
}
}
}
}

return $cmd . ' ' . __DIR__ . '/' . $script . ' ';
}
}
Expand Down

0 comments on commit bfd2747

Please sign in to comment.