How to use setPharGeneratorScript method of builder class

Best Atoum code snippet using builder.setPharGeneratorScript

builder.php

Source:builder.php Github

copy

Full Screen

...35 $this36 ->setVcs()37 ->setPhp()38 ->setUnitTestRunnerScript(self::defaultUnitTestRunnerScript)39 ->setPharGeneratorScript(self::defaultPharGeneratorScript)40 ;41 }42 public function setVcs(builder\vcs $vcs = null)43 {44 $this->vcs = $vcs ?: new builder\vcs\svn();45 return $this;46 }47 public function getVcs()48 {49 return $this->vcs;50 }51 public function setTaggerEngine(atoum\scripts\tagger\engine $engine)52 {53 $this->taggerEngine = $engine;54 return $this;55 }56 public function getTaggerEngine()57 {58 return $this->taggerEngine;59 }60 public function setPhp(atoum\php $php = null)61 {62 $this->php = $php ?: new atoum\php();63 return $this;64 }65 public function getPhp()66 {67 return $this->php;68 }69 public function setPhpPath($path)70 {71 $this->php->setBinaryPath($path);72 return $this;73 }74 public function getPhpPath()75 {76 return $this->php->getBinaryPath();77 }78 public function getRunnerConfigurationFiles()79 {80 return $this->runnerConfigurationFiles;81 }82 public function addRunnerConfigurationFile($file)83 {84 $this->runnerConfigurationFiles[] = (string) $file;85 return $this;86 }87 public function enablePharCreation()88 {89 $this->pharCreationEnabled = true;90 return $this;91 }92 public function disablePharCreation()93 {94 $this->pharCreationEnabled = false;95 return $this;96 }97 public function pharCreationIsEnabled()98 {99 return $this->pharCreationEnabled;100 }101 public function disableUnitTestChecking()102 {103 $this->checkUnitTests = false;104 return $this;105 }106 public function enableUnitTestChecking()107 {108 $this->checkUnitTests = true;109 return $this;110 }111 public function unitTestCheckingIsEnabled()112 {113 return $this->checkUnitTests;114 }115 public function setVersion($version)116 {117 $this->version = (string) $version;118 return $this;119 }120 public function getVersion()121 {122 return $this->version;123 }124 public function setScoreDirectory($path)125 {126 $this->scoreDirectory = static::cleanDirectoryPath($path);127 return $this;128 }129 public function getScoreDirectory()130 {131 return $this->scoreDirectory;132 }133 public function setErrorsDirectory($path)134 {135 $this->errorsDirectory = static::cleanDirectoryPath($path);136 return $this;137 }138 public function getErrorsDirectory()139 {140 return $this->errorsDirectory;141 }142 public function setDestinationDirectory($path)143 {144 $this->destinationDirectory = static::cleanDirectoryPath($path);145 return $this;146 }147 public function getDestinationDirectory()148 {149 return $this->destinationDirectory;150 }151 public function setWorkingDirectory($path)152 {153 $this->workingDirectory = static::cleanDirectoryPath($path);154 return $this;155 }156 public function getWorkingDirectory()157 {158 return $this->workingDirectory;159 }160 public function setRevisionFile($path)161 {162 $this->revisionFile = (string) $path;163 return $this;164 }165 public function getRevisionFile()166 {167 return $this->revisionFile;168 }169 public function setReportTitle($title)170 {171 $this->reportTitle = (string) $title;172 return $this;173 }174 public function getReportTitle()175 {176 return $this->reportTitle;177 }178 public function setUnitTestRunnerScript($path)179 {180 $this->unitTestRunnerScript = (string) $path;181 return $this;182 }183 public function getUnitTestRunnerScript()184 {185 return $this->unitTestRunnerScript;186 }187 public function setPharGeneratorScript($path)188 {189 $this->pharGeneratorScript = (string) $path;190 return $this;191 }192 public function getPharGeneratorScript()193 {194 return $this->pharGeneratorScript;195 }196 public function setRunFile($path)197 {198 $this->runFile = $path;199 return $this;200 }201 public function getRunFile()202 {203 return $this->runFile !== null ? $this->runFile : $this->adapter->sys_get_temp_dir() . \DIRECTORY_SEPARATOR . md5(get_class($this));204 }205 public function checkUnitTests()206 {207 $status = true;208 if ($this->checkUnitTests === true)209 {210 if ($this->workingDirectory === null)211 {212 throw new exceptions\logic('Unable to check unit tests, working directory is undefined');213 }214 $this->vcs215 ->setWorkingDirectory($this->workingDirectory)216 ->exportRepository()217 ;218 $this->php219 ->reset()220 ->addOption('-f', $this->workingDirectory . \DIRECTORY_SEPARATOR . $this->unitTestRunnerScript)221 ->addArgument('-ncc')222 ->addArgument('-d', $this->workingDirectory . \DIRECTORY_SEPARATOR . 'tests' . \DIRECTORY_SEPARATOR . 'units' . \DIRECTORY_SEPARATOR . 'classes')223 ->addArgument('-p', $this->php->getBinaryPath())224 ;225 $scoreFile = $this->scoreDirectory === null ? $this->adapter->tempnam($this->adapter->sys_get_temp_dir(), '') : $this->scoreDirectory . DIRECTORY_SEPARATOR . $this->vcs->getRevision();226 $this->php->addArgument('-sf', $scoreFile);227 if ($this->reportTitle !== null)228 {229 $this->php->addArgument('-drt', sprintf($this->reportTitle, '%1$s', '%2$s', '%3$s', $this->vcs->getRevision()));230 }231 foreach ($this->runnerConfigurationFiles as $runnerConfigurationFile)232 {233 $this->php->addArgument('-c', $runnerConfigurationFile);234 }235 try236 {237 $exitCode = $this->php->run()->getExitCode();238 if ($exitCode > 0)239 {240 switch ($exitCode)241 {242 case 126:243 case 127:244 throw new exceptions\runtime('Unable to find \'' . $this->php->getBinaryPath() . '\' or it is not executable');245 default:246 throw new exceptions\runtime($this->php . ' failed with exit code \'' . $exitCode . '\': ' . $this->php->getStderr());247 }248 }249 $stdErr = $this->php->getStdErr();250 if ($stdErr != '')251 {252 throw new exceptions\runtime($stdErr);253 }254 $score = @$this->adapter->file_get_contents($scoreFile);255 if ($score === false)256 {257 throw new exceptions\runtime('Unable to read score from file \'' . $scoreFile . '\'');258 }259 $score = $this->adapter->unserialize($score);260 if ($score === false)261 {262 throw new exceptions\runtime('Unable to unserialize score from file \'' . $scoreFile . '\'');263 }264 if ($score instanceof atoum\score === false)265 {266 throw new exceptions\runtime('Contents of file \'' . $scoreFile . '\' is not a score');267 }268 $status = $score->getFailNumber() === 0 && $score->getExceptionNumber() === 0 && $score->getErrorNumber() === 0;269 }270 catch (\exception $exception)271 {272 $this->writeErrorInErrorsDirectory($exception->getMessage());273 $status = false;274 }275 if ($this->scoreDirectory === null)276 {277 if ($this->adapter->unlink($scoreFile) === false)278 {279 throw new exceptions\runtime('Unable to delete score file \'' . $scoreFile . '\'');280 }281 }282 }283 return $status;284 }285 public function createPhar($version = null)286 {287 $pharBuilt = true;288 if ($this->pharCreationEnabled === true)289 {290 if ($this->destinationDirectory === null)291 {292 throw new exceptions\logic('Unable to create phar, destination directory is undefined');293 }294 if ($this->workingDirectory === null)295 {296 throw new exceptions\logic('Unable to create phar, working directory is undefined');297 }298 if ($this->revisionFile !== null)299 {300 $revision = trim(@$this->adapter->file_get_contents($this->revisionFile));301 if (is_numeric($revision) === true)302 {303 $this->vcs->setRevision($revision);304 }305 }306 $revisions = $this->vcs->getNextRevisions();307 while (sizeof($revisions) > 0)308 {309 $revision = array_shift($revisions);310 $this->vcs->setRevision($revision);311 try312 {313 if ($this->checkUnitTests() === true)314 {315 if ($this->checkUnitTests === false)316 {317 $this->vcs318 ->setWorkingDirectory($this->workingDirectory)319 ->exportRepository()320 ;321 }322 if ($this->taggerEngine !== null)323 {324 $this->taggerEngine325 ->setSrcDirectory($this->workingDirectory)326 ->setVersion($version !== null ? $version : 'nightly-' . $revision . '-' . $this->adapter->date('YmdHi'))327 ->tagVersion()328 ;329 }330 $this->php331 ->reset()332 ->addOption('-d', 'phar.readonly=0')333 ->addOption('-f', $this->workingDirectory . DIRECTORY_SEPARATOR . $this->pharGeneratorScript)334 ->addArgument('-d', $this->destinationDirectory)335 ;336 if ($this->php->run()->getExitCode() > 0)337 {338 throw new exceptions\runtime('Unable to run ' . $this->php . ': ' . $this->php->getStdErr());339 }340 }341 }342 catch (\exception $exception)343 {344 $pharBuilt = false;345 $this->writeErrorInErrorsDirectory($exception->getMessage());346 }347 if ($this->revisionFile !== null && $this->adapter->file_put_contents($this->revisionFile, $revision, \LOCK_EX) === false)348 {349 throw new exceptions\runtime('Unable to save last revision in file \'' . $this->revisionFile . '\'');350 }351 $revisions = $this->vcs->getNextRevisions();352 }353 }354 return $pharBuilt;355 }356 public function writeErrorInErrorsDirectory($error)357 {358 if ($this->errorsDirectory !== null)359 {360 $revision = $this->vcs === null ? null : $this->vcs->getRevision();361 if ($revision === null)362 {363 throw new exceptions\logic('Revision is undefined');364 }365 $errorFile = $this->errorsDirectory . \DIRECTORY_SEPARATOR . $revision;366 if ($this->adapter->file_put_contents($errorFile, $error, \LOCK_EX | \FILE_APPEND) === false)367 {368 throw new exceptions\runtime('Unable to save error in file \'' . $errorFile . '\'');369 }370 }371 return $this;372 }373 protected function includeConfigFile($path, \closure $callback = null)374 {375 if ($callback === null)376 {377 $builder = $this;378 $callback = function($path) use ($builder) { include_once($path); };379 }380 return parent::includeConfigFile($path, $callback);381 }382 protected function setArgumentHandlers()383 {384 $builder = $this;385 return parent::setArgumentHandlers()386 ->addArgumentHandler(387 function($script, $argument, $files) use ($builder) {388 if (sizeof($files) <= 0)389 {390 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));391 }392 foreach ($files as $file)393 {394 if (file_exists($file) === false)395 {396 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Runner configuration file path \'%s\' is invalid'), $file));397 }398 if (is_readable($file) === false)399 {400 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Unable to read runner configuration file \'%s\''), $file));401 }402 $script->addRunnerConfigurationFile($file);403 }404 },405 array('-rc', '--runner-configuration-files'),406 '<file>',407 $this->locale->_('Use <file> as configuration file for runner')408 )409 ->addArgumentHandler(410 function($script, $argument, $path) {411 if (sizeof($path) != 1)412 {413 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));414 }415 $script->setPhpPath(current($path));416 },417 array('-p', '--php'),418 '<path>',419 $this->locale->_('Path to PHP binary')420 )421 ->addArgumentHandler(422 function($script, $argument, $directory) {423 if (sizeof($directory) != 1)424 {425 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));426 }427 $script->setWorkingDirectory(current($directory));428 },429 array('-w', '--working-directory'),430 '<directory>',431 $this->locale->_('Checkout file from repository in <directory>')432 )433 ->addArgumentHandler(434 function($script, $argument, $directory) {435 if (sizeof($directory) != 1)436 {437 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));438 }439 $script->setDestinationDirectory(current($directory));440 },441 array('-d', '--destination-directory'),442 '<directory>',443 $this->locale->_('Save phar in <directory>')444 )445 ->addArgumentHandler(446 function($script, $argument, $directory) {447 if (sizeof($directory) != 1)448 {449 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));450 }451 $script->setScoreDirectory(current($directory));452 },453 array('-sd', '--score-directory'),454 '<directory>',455 $this->locale->_('Save score in <directory>')456 )457 ->addArgumentHandler(458 function($script, $argument, $directory) {459 if (sizeof($directory) != 1)460 {461 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));462 }463 $script->setErrorsDirectory(current($directory));464 },465 array('-ed', '--errors-directory'),466 '<directory>',467 $this->locale->_('Save errors in <directory>')468 )469 ->addArgumentHandler(470 function($script, $argument, $url) {471 if (sizeof($url) != 1)472 {473 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));474 }475 $script->getVcs()->setRepositoryUrl(current($url));476 },477 array('-r', '--repository-url'),478 '<url>',479 $this->locale->_('Url of repository')480 )481 ->addArgumentHandler(482 function($script, $argument, $file) {483 if (sizeof($file) != 1)484 {485 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));486 }487 $script->setRevisionFile(current($file));488 },489 array('-rf', '--revision-file'),490 '<file>',491 $this->locale->_('Save last revision in <file>')492 )493 ->addArgumentHandler(494 function($script, $argument, $version) {495 if (sizeof($version) != 1)496 {497 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));498 }499 $script->setVersion(current($version));500 },501 array('-v', '--version'),502 '<string>',503 $this->locale->_('Version <string> will be used as version name')504 )505 ->addArgumentHandler(506 function($script, $argument, $unitTestRunnerScript) {507 if (sizeof($unitTestRunnerScript) != 1)508 {509 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));510 }511 $script->setUnitTestRunnerScript(current($unitTestRunnerScript));512 },513 array('-utrs', '--unit-test-runner-script')514 )515 ->addArgumentHandler(516 function($script, $argument, $pharGeneratorScript) {517 if (sizeof($pharGeneratorScript) != 1)518 {519 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));520 }521 $script->setPharGeneratorScript(current($pharGeneratorScript));522 },523 array('-pgs', '--phar-generator-script')524 )525 ->addArgumentHandler(526 function($script, $argument, $reportTitle) {527 if (sizeof($reportTitle) != 1)528 {529 throw new exceptions\logic\invalidArgument(sprintf($script->getLocale()->_('Bad usage of %s, do php %s --help for more informations'), $argument, $script->getName()));530 }531 $script->setReportTitle(current($reportTitle));532 },533 array('-rt', '--report-title')534 )535 ;...

Full Screen

Full Screen

setPharGeneratorScript

Using AI Code Generation

copy

Full Screen

1$builder = new PharBuilder('test.phar');2$builder->setPharGeneratorScript('2.php');3$builder->build();4$builder = new PharBuilder('test.phar');5$builder->setPharGeneratorScript('3.php');6$builder->build();7$builder = new PharBuilder('test.phar');8$builder->setPharGeneratorScript('4.php');9$builder->build();10$builder = new PharBuilder('test.phar');11$builder->setPharGeneratorScript('5.php');12$builder->build();13$builder = new PharBuilder('test.phar');14$builder->setPharGeneratorScript('6.php');15$builder->build();16$builder = new PharBuilder('test.phar');17$builder->setPharGeneratorScript('7.php');18$builder->build();19$builder = new PharBuilder('test.phar');20$builder->setPharGeneratorScript('8.php');21$builder->build();22$builder = new PharBuilder('test.phar');23$builder->setPharGeneratorScript('9.php');24$builder->build();25$builder = new PharBuilder('test.phar');26$builder->setPharGeneratorScript('10.php');27$builder->build();28$builder = new PharBuilder('test.phar');29$builder->setPharGeneratorScript('11.php');

Full Screen

Full Screen

setPharGeneratorScript

Using AI Code Generation

copy

Full Screen

1$builder = new \Phalcon\Builder\Project();2$builder->setPharGeneratorScript('generate.phar.php');3$builder->build(array(4));5$project = new \Phalcon\Builder\Project();6$project->setPharGeneratorScript('generate.phar.php');7$project->build(array(8));9$module = new \Phalcon\Builder\Module();10$module->setPharGeneratorScript('generate.phar.php');11$module->build(array(12));13$controller = new \Phalcon\Builder\Controller();14$controller->setPharGeneratorScript('generate.phar.php');15$controller->build(array(16));17$model = new \Phalcon\Builder\Model();18$model->setPharGeneratorScript('generate.phar.php');19$model->build(array(20));

Full Screen

Full Screen

setPharGeneratorScript

Using AI Code Generation

copy

Full Screen

1$builder = new \Phalcon\Build\Builder();2$builder->setPharGeneratorScript('phar.php');3$builder->build();4$phar = new Phar('phalcon.phar', 0, 'phalcon.phar');5$phar->buildFromDirectory('phalcon/');6$phar->setDefaultStub('phalcon.php', 'phalcon.php');7$phar->setSignatureAlgorithm(Phar::SHA1);8$phar->stopBuffering();

Full Screen

Full Screen

setPharGeneratorScript

Using AI Code Generation

copy

Full Screen

1$builder = new PharBuilder();2$builder->setPharGeneratorScript('phar_generator.php');3$builder->setPharPath('phar.phar');4$builder->setPharName('phar');5$builder->setPharOutputPath('phar.phar');6$builder->addFile('1.php');7$builder->addFile('2.php');8$builder->addFile('3.php');9$builder->build();10$phar = $this;11$phar->buildFromDirectory('src');12$phar->setStub($phar->createDefaultStub('index.php'));13$phar->stopBuffering();14Phar::mapPhar('phar.phar');15__HALT_COMPILER();16$builder = new PharBuilder();17$builder->setPharPath('phar.phar');18$builder->setPharName('phar');19$builder->setPharOutputPath('phar.phar');20$builder->addFile('1.php');21$builder->addFile('2.php');22$builder->addFile('3.php');23$builder->build();24Phar::mapPhar('phar.phar');25__HALT_COMPILER();26$builder = new PharBuilder();27$builder->setPharPath('phar.phar');28$builder->setPharName('phar');29$builder->setPharOutputPath('phar.phar');30$builder->addFile('1.php');31$builder->addFile('2.php');32$builder->addFile('3.php');33$builder->build();

Full Screen

Full Screen

setPharGeneratorScript

Using AI Code Generation

copy

Full Screen

1$builder = new PharBuilder();2$builder->setPharGeneratorScript("phar_generator.php");3$builder->build("1.php");4$builder->run();5$builder = new PharBuilder();6$builder->buildPhar("1.php", "1.phar");7$builder = new PharBuilder();8$builder->buildPhar("1.php", "1.phar");9$builder->run();10$builder = new PharBuilder();11$builder->buildPhar("1.php", "1.phar");12$builder->run();13$builder = new PharBuilder();14$builder->buildPhar("1.php", "1.phar");15$builder->run();16$builder = new PharBuilder();17$builder->buildPhar("1.php", "1.phar");18$builder->run();19$builder = new PharBuilder();20$builder->buildPhar("1.php", "1.phar");21$builder->run();22$builder = new PharBuilder();23$builder->buildPhar("1.php", "1.phar");24$builder->run();25$builder = new PharBuilder();26$builder->buildPhar("1.php", "1.phar");27$builder->run();28$builder = new PharBuilder();29$builder->buildPhar("1.php", "1.phar");30$builder->run();31$builder = new PharBuilder();32$builder->buildPhar("1.php", "1.phar");33$builder->run();

Full Screen

Full Screen

setPharGeneratorScript

Using AI Code Generation

copy

Full Screen

1$builder = new PharBuilder();2$builder->setPharGeneratorScript('2.php');3$builder->build();4$phar = new Phar('test.phar');5$phar->startBuffering();6$phar->buildFromDirectory('src');7$phar->stopBuffering();8$phar->setStub($phar->createDefaultStub('index.php'));9$phar->compressFiles(Phar::GZ);

Full Screen

Full Screen

setPharGeneratorScript

Using AI Code Generation

copy

Full Screen

1$builder->setPharGeneratorScript('phar_generator.php');2$builder->build();3$builder->setPharGeneratorScript('phar_generator.php');4$builder->build();5$builder->setPharGeneratorScript('phar_generator.php');6$builder->build();7$builder->setPharGeneratorScript('phar_generator.php');8$builder->build();9$builder->setPharGeneratorScript('phar_generator.php');10$builder->build();11$builder->setPharGeneratorScript('phar_generator.php');12$builder->build();13$builder->setPharGeneratorScript('phar_generator.php');14$builder->build();

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger setPharGeneratorScript code on LambdaTest Cloud Grid

Execute automation tests with setPharGeneratorScript on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful