示例#1
0
 public function testZipReturnsAZipFileLocation()
 {
     $file1 = ['name' => 'foobar', 'content' => 'file1 content'];
     $file2 = ['name' => 'fizzbuzz', 'content' => 'file2 content'];
     $file3 = ['name' => 'bizzbang', 'content' => 'file3 content'];
     $this->archive->expects($this->exactly(3))->method('file_put_contents');
     $this->archive->expects($this->once())->method('exec');
     $targetDir = '/tmp/foobar';
     $baseDir = 'foobar';
     $this->setAttribute($this->archive, 'targetDir', $targetDir);
     $exec = sprintf(Archive::ZIP_COMMAND, $targetDir, $targetDir . '.zip', $baseDir);
     $this->archive->expects($this->once())->method('exec')->with($exec);
     $this->archive->queueToFile($file1['name'], $file1['content']);
     $this->archive->queueToFile($file2['name'], $file2['content']);
     $this->archive->queueToFile($file3['name'], $file3['content']);
     $this->archive->write();
     $returned = $this->archive->zip();
     $this->assertEquals($targetDir . '.zip', $returned);
 }
示例#2
0
 /**
  * @return string
  */
 public function getPuppetModules()
 {
     $this->archive = new Extension\Archive('puphpet/puppet/modules');
     $this->archive->write();
     return $this->archive->zip();
 }