Source of file FileTest.php
Size: 2,357 Bytes - Last Modified: 2021-12-24T06:51:27+00:00
/var/www/docs.ssmods.com/process/src/tests/Output/FileTest.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 | <?php namespace Heyday\SilverStripe\WkHtml\Output; use Knp\Snappy\GeneratorInterface; use org\bovigo\vfs\vfsStream; use SilverStripe\Dev\SapphireTest; /** * Generated by PHPUnit_SkeletonGenerator 1.2.0 on 2013-04-28 at 12:35:11. */ class FileTest extends SapphireTest { /** * */ public function testFileExists() { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('File already exists.'); vfsStream::setup( 'root', null, [ 'test.pdf' => '', ] ); File::create('vfs://root/test.pdf'); } /** * */ public function testDirectoryNotWritable() { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('Directory is not writable.'); vfsStream::setup( 'root', 0000 ); File::create('vfs://root/test.pdf'); } public function testProcess() { vfsStream::setup( 'root' ); $file = File::create($path = 'vfs://root/test.pdf'); /** @var GeneratorInterface|\PHPUnit_Framework_MockObject_MockObject $generator */ $generator = $this->createMock(GeneratorInterface::class); $generator->expects($this->once()) ->method('generateFromHtml') ->with( $this->equalTo('test'), $this->equalTo($path), $this->equalTo([]), $this->equalTo(false) ); $file->process('test', $generator); } public function testProcessOverwrite() { vfsStream::setup( 'root', null, [ 'test.pdf' => '', ] ); $file = File::create($path = 'vfs://root/test.pdf', true); /** @var GeneratorInterface|\PHPUnit_Framework_MockObject_MockObject $generator */ $generator = $this->createMock(GeneratorInterface::class); $generator->expects($this->once()) ->method('generateFromHtml') ->with( $this->equalTo('test'), $this->equalTo($path), $this->equalTo([]), $this->equalTo(true) ); $file->process('test', $generator); } } |