Skip to content

Commit

Permalink
Merged pull request #954
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Mar 6, 2024
2 parents a27262d + 3dc4087 commit b303190
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
9 changes: 7 additions & 2 deletions tests/coverage/dump-branch-coverage.inc
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php
require dirname(__FILE__) . '/../../contrib/branch-coverage-to-dot.php';
require_once __DIR__ . '/../../contrib/branch-coverage-to-dot.php';
require_once __DIR__ . '/../utils.inc';

function dump_branch_coverage($info)
{
file_put_contents(sys_get_temp_dir() . "/paths.dot", branch_coverage_to_dot( $info ) );
file_put_contents( getTmpDir() . "xdebug-paths.dot", branch_coverage_to_dot( $info ) );
ksort($info);

foreach ( $info as $fname => $file )
Expand All @@ -12,6 +13,10 @@ function dump_branch_coverage($info)
{
continue;
}
if ( preg_match( '/utils.inc$/', $fname ) )
{
continue;
}

if ( !isset( $file['functions'] ) )
{
Expand Down
11 changes: 3 additions & 8 deletions tests/debugger/dbgp/dbgpclient.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
require_once __DIR__ . '/../../utils.inc';

class DebugClient
{
// free port will be selected automatically by the operating system
Expand Down Expand Up @@ -33,14 +35,7 @@ protected function getAddress()

public function __construct()
{
$envTmpDir = getenv('TEST_TMP_DIR');
$this->tmpDir = $envTmpDir !== false ? $envTmpDir : sys_get_temp_dir();
$this->tmpDir .= '/';
$workerId = getenv( 'TEST_PHP_WORKER' );
if ( $workerId !== false )
{
$this->tmpDir .= "{$workerId}-";
}
$this->tmpDir = getTmpDir();
}

private function open( &$errno, &$errstr )
Expand Down
14 changes: 14 additions & 0 deletions tests/utils.inc
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,18 @@ function mustNotBeExecuted( array $coverageInfo, array $lines )
echo "line #{$line} is present and not covered\n";
}
}

function getTmpDir() : string
{
$envTmpDir = getenv('TEST_TMP_DIR');
$tmpDir = $envTmpDir !== false ? $envTmpDir : sys_get_temp_dir();
$tmpDir .= '/';
$workerId = getenv( 'TEST_PHP_WORKER' );
if ( $workerId !== false )
{
$tmpDir .= "{$workerId}-";
}

return $tmpDir;
}
?>

0 comments on commit b303190

Please sign in to comment.