/** * @covers ::compile */ public function test_compile() { $Dir = dirname(dirname(__DIR__)) . '/vendor/mrclay'; $Dir = new GenericFile($Dir); // Valid arguments $this->assertTrue($this->Archiver->addDir($Dir, 'php', 'txt', 'js', 'css'), 'Archiver::addFiles() Returned an invalid value'); $this->assertTrue($this->Archiver->compile('BLW'), 'Archiver::compile() Returned an invalid value'); // Invalid Project try { $this->Archiver->compile(NULL); $this->fail('Failed to generate exception with invalid arguments'); } catch (InvalidArgumentException $e) { } }
} }); $Output->overwrite('-Packaging files'); $Output->write("\r\n[=-------------------------------------------------]"); $Compiler->compile('BLW'); unset($Compiler); $Output->overwrite('-Creating archive'); $Output->write("\r\n[========================================----------]"); // Copy assets $TempBuild = BLW_DIR . 'temp' . DIRECTORY_SEPARATOR . 'build' . DIRECTORY_SEPARATOR; @mkdir($TempBuild); copy(BLW_DIR . 'build/BLW.phar', $TempBuild . 'BLW.phar'); copy(BLW_DIR . 'LICENSE.md', $TempBuild . 'LICENSE.md'); $Output->overwrite("[=========================================---------]"); // Create Archive $Archiver = new Archiver(new GenericFile(BLW_DIR . 'build'), new GenericFile($TempBuild), new GenericFile(BLW_DIR . 'temp'), $Command->getMediator()); $Archiver->addDir(new GenericFile($TempBuild), '*'); $Archiver->onAdvance(function ($Event) use(&$Output) { static $Total = 0; static $Percent = 0; // Add count $Total += $Event->Steps; // Check count if ($Total > 100) { // Reset $Total = $Total % 100; // Advance $Percent++; $Output->overwrite(substr_replace('[=========================================---------]', str_repeat('=', $Percent), 41, $Percent)); } });