Exemple #1
0
 public function testZipReadWriteFails()
 {
     if (defined('HHVM_VERSION')) {
         $this->markTestSkipped('HHVM does not support mocking of ZipArchive');
     }
     $mock = Mockery::mock('ZipArchive');
     $mock->shouldReceive('open')->andReturn(true);
     $mock->shouldReceive('close')->andReturn(true);
     $mock->shouldReceive('addFromString')->andReturn(false);
     $mock->shouldReceive('getFromName')->andReturn(false);
     $mock->shouldReceive('getStream')->andReturn(false);
     $zip = new Zip('location', $mock);
     $this->assertFalse($zip->write('file', 'contents', new Config()));
     $this->assertFalse($zip->read('file'));
     $this->assertFalse($zip->getMimetype('file'));
     $this->assertFalse($zip->readStream('file'));
 }