public function creatingArchive() { $contents = array('lang/Object.class.php' => 'class Object { }', 'lang/Type.class.php' => 'class Type extends Object { }'); $a = new Archive(new Stream()); $a->open(ARCHIVE_CREATE); foreach ($contents as $filename => $bytes) { $a->addFileBytes($filename, NULL, NULL, $bytes); } $a->create(); $this->assertEntries($a, $contents); }
/** * Adds sourcecode to a given XAR archive * * @param lang.archive.Archive a * @param string name * @param string bytes sourcecode */ protected function add(Archive $a, $name, $bytes) { $a->addFileBytes($name . '.class.php', $path = '', $name . '.class.php', '<?php ' . $bytes . ' ?>'); }