4 * Code shared between the unit and integration tests
6 trait TempFSFileTestTrait
{
7 abstract protected function newFile();
10 * @covers TempFSFile::__construct
11 * @covers TempFSFile::purge
13 public function testPurge() {
14 $file = $this->newFile();
15 $this->assertTrue( file_exists( $file->getPath() ) );
17 $this->assertFalse( file_exists( $file->getPath() ) );
21 * @covers TempFSFile::__construct
22 * @covers TempFSFile::bind
23 * @covers TempFSFile::autocollect
24 * @covers TempFSFile::__destruct
26 public function testBind() {
27 $file = $this->newFile();
28 $path = $file->getPath();
29 $this->assertTrue( file_exists( $path ) );
33 $this->assertTrue( file_exists( $path ) );
35 $this->assertFalse( file_exists( $path ) );
39 * @covers TempFSFile::__construct
40 * @covers TempFSFile::preserve
41 * @covers TempFSFile::__destruct
43 public function testPreserve() {
44 $file = $this->newFile();
45 $path = $file->getPath();
46 $this->assertTrue( file_exists( $path ) );
49 $this->assertTrue( file_exists( $path ) );
50 Wikimedia\
suppressWarnings();
52 Wikimedia\restoreWarnings
();