Skip to content
Snippets Groups Projects
Unverified Commit 7510f3eb authored by totten's avatar totten Committed by GitHub
Browse files

Merge pull request #25909 from totten/5.60-vertest

(NFC) Version Check Test - Fix multi-user and concurrent execution
parents 9d4e2929 37125ae4
Branches
Tags
No related merge requests found
......@@ -8,9 +8,16 @@ use Civi\Test\Invasive;
*/
class CRM_Utils_versionCheckTest extends CiviUnitTestCase {
/**
* @var string
*/
protected $tempDir;
public function setUp(): void {
$this->useTransaction();
parent::setUp();
$this->tempDir = sys_get_temp_dir() . '/VersionCheck-' . rand() . rand();
mkdir($this->tempDir);
}
/**
......@@ -98,11 +105,14 @@ class CRM_Utils_versionCheckTest extends CiviUnitTestCase {
if (file_exists($vc->cacheFile)) {
unlink($vc->cacheFile);
}
if (file_exists($this->tempDir)) {
CRM_Utils_File::cleanDir($this->tempDir, TRUE, FALSE);
}
}
public function testCronFallback() {
// Fake "remote" source data
$tmpSrc = '/tmp/versionCheckTestFile.json';
$tmpSrc = $this->tempDir . '/versionCheckTestFile.json';
file_put_contents($tmpSrc, json_encode($this->sampleVersionInfo));
$vc = new CRM_Utils_VersionCheck();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment