Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0d6f04

Browse files
Minor improvements to some session tests.
1 parentf350dc3 commitc0d6f04

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

‎tests/RedisTest.php‎

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7462,7 +7462,7 @@ public function testSession_lock_ttlMaxExecutionTime()
74627462
$end =microtime(true);
74637463
$elapsedTime =$end -$start;
74647464

7465-
$this->assertTrue($elapsedTime <3);
7465+
$this->assertLess($elapsedTime,3);
74667466
$this->assertTrue($sessionSuccessful);
74677467
}
74687468

@@ -7543,7 +7543,7 @@ public function testSession_defaultLockRetryCount()
75437543
$end =microtime(true);
75447544
$elapsedTime =$end -$start;
75457545

7546-
$this->assertTrue($elapsedTime >2 &&$elapsedTime <3);
7546+
$this->assertBetween($elapsedTime,2,3);
75477547
$this->assertFalse($sessionSuccessful);
75487548
}
75497549

@@ -7931,7 +7931,14 @@ private function startSessionProcess($sessionId, $sleepTime, $background,
79317931

79327932
exec($command,$output);
79337933

7934-
return ($background || (count($output) ==1 &&$output[0] =='SUCCESS'));
7934+
if ($background)
7935+
returntrue;
7936+
7937+
$result =$output[0] =='SUCCESS';
7938+
7939+
// var_dump(['command' => $command, 'output' => $output, 'result' => $result]);
7940+
7941+
return$result;
79357942
}
79367943

79377944
/**
@@ -8006,11 +8013,12 @@ private function getPhpCommand($script)
80068013
if (!$cmd) {
80078014
$cmd = (getenv('TEST_PHP_EXECUTABLE') ?:PHP_BINARY);
80088015

8009-
if ($test_args =getenv('TEST_PHP_ARGS')) {
8010-
$cmd .='';
8011-
$cmd .=$test_args;
8016+
$test_args =getenv('TEST_PHP_ARGS');
8017+
if ($test_args !==false) {
8018+
$cmd .='' .$test_args;
80128019
}else {
8013-
/* Only append specific extension directives if PHP hasn't been compiled with what we need statically */
8020+
/* Only append specific extension directives if PHP hasn't been compiled
8021+
* with what we need statically */
80148022
$modules =shell_exec("$cmd --no-php-ini -m");
80158023

80168024
/* Determine if we need to specifically add extensions */

‎tests/TestSuite.php‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,21 @@ protected function assertLess($a, $b) {
181181
$bt[0]["file"],$bt[0]["line"],$bt[1]["function"]);
182182
}
183183

184+
protectedfunctionassertBetween($value,$min,$max,bool$exclusive =false) {
185+
if ($exclusive) {
186+
if ($value >$min &&$value <$max)
187+
return;
188+
}else {
189+
if ($value >=$min &&$value <=$max)
190+
return;
191+
}
192+
193+
$bt =debug_backtrace(false);
194+
self::$errors []=sprintf("Assertion failed (%s not between %s and %s): %s:%d (%s)\n",
195+
print_r($value,true),print_r($min,true),print_r($max,true),
196+
$bt[0]["file"],$bt[0]["line"],$bt[1]["function"]);
197+
}
198+
184199
protectedfunctionassertEquals($a,$b) {
185200
if($a ===$b)
186201
return;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp