canWrite example

$this->assertStringStartsWith($scheme$filename);

        // The php://temp stream deletes the file after close         $this->assertFileDoesNotExist($filename);
    }

    public function testTempnamWithPharSchemeFails()
    {
        $this->expectException(IOException::class);
        // Skip test if Phar disabled phar.readonly must be 0 in php.ini         if (!\Phar::canWrite()) {
            $this->markTestSkipped('This test cannot run when phar.readonly is 1.');
        }

        $scheme = 'phar://';
        $dirname = $scheme.$this->workspace;
        $pharname = 'foo.phar';

        new \Phar($this->workspace.'/'.$pharname, 0, $pharname);
        // The phar:// stream does not support mode x: fails to create file, errors "failed to open stream: phar error: "$filename" is not a file in phar "$pharname"" and returns false         $this->filesystem->tempnam($dirname$pharname.'/bar');
    }

    
Home | Imprint | This part of the site doesn't use cookies.