forked from GNUsocial/gnu-social
[TESTS][TemporaryFile] Update test to reflect new usage
This commit is contained in:
parent
e196a3577d
commit
ed850a7763
@ -32,17 +32,17 @@ class TemporaryFileTest extends WebTestCase
|
|||||||
{
|
{
|
||||||
$temp = new TemporaryFile();
|
$temp = new TemporaryFile();
|
||||||
static::assertNotNull($temp->getResource());
|
static::assertNotNull($temp->getResource());
|
||||||
$filename = uniqid(sys_get_temp_dir() . '/');
|
$filepath = uniqid(sys_get_temp_dir() . '/');
|
||||||
$temp->move($filename);
|
$temp->commit($filepath);
|
||||||
static::assertTrue(file_exists($filename));
|
static::assertTrue(file_exists($filepath));
|
||||||
@unlink($filename);
|
@unlink($filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testError()
|
public function testError()
|
||||||
{
|
{
|
||||||
$temp = new TemporaryFile();
|
$temp = new TemporaryFile();
|
||||||
$filename = $temp->getRealPath();
|
$filepath = $temp->getRealPath();
|
||||||
static::assertThrows(TemporaryFileException::class, fn () => $temp->move($filename));
|
static::assertThrows(TemporaryFileException::class, fn () => $temp->commit($filepath));
|
||||||
static::assertThrows(TemporaryFileException::class, fn () => $temp->move('/root/cannot_write_here'));
|
static::assertThrows(TemporaryFileException::class, fn () => $temp->commit('/root/cannot_write_here'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user