[lang-ref] ( temp_file ) ( php )
<?php
public function testTempFile(): void
{
// tempnam($dir, $prefix)
$tempFile = tempnam(sys_get_temp_dir(), 'tmp_'); // file is created and returns path
$this->assertStringContainsString('/var/', $tempFile); // mac / linux
$this->assertTrue(file_exists($tempFile));
unlink($tempFile);
}