Best Atoum code snippet using vcs.setRevision
builder.php
Source:builder.php
...231 public function testSetRevisionFile()232 {233 $builder = new scripts\builder(uniqid());234 $this->assert235 ->object($builder->setRevisionFile($file = uniqid()))->isIdenticalTo($builder)236 ->string($builder->getRevisionFile())->isEqualTo($file)237 ;238 }239 public function testAddRunnerConfigurationFile()240 {241 $builder = new scripts\builder(uniqid());242 $this->assert243 ->object($builder->addRunnerConfigurationFile($file = uniqid()))->isIdenticalTo($builder)244 ->array($builder->getRunnerConfigurationFiles())->isEqualTo(array($file))245 ;246 }247 public function testSetRunFile()248 {249 $builder = new scripts\builder(uniqid());250 $this->assert251 ->object($builder->setRunFile($runFile = uniqid()))->isIdenticalTo($builder)252 ->string($builder->getRunFile())->isEqualTo($runFile)253 ;254 }255 public function testDisableUnitTestChecking()256 {257 $builder = new scripts\builder(uniqid());258 $this->assert259 ->boolean($builder->unitTestCheckingIsEnabled())->isTrue()260 ->object($builder->disableUnitTestChecking())->isIdenticalTo($builder)261 ->boolean($builder->unitTestCheckingIsEnabled())->isFalse()262 ;263 }264 public function testEnableUnitTestChecking()265 {266 $builder = new scripts\builder(uniqid());267 $builder->disableUnitTestChecking();268 $this->assert269 ->boolean($builder->unitTestCheckingIsEnabled())->isFalse()270 ->object($builder->enableUnitTestChecking())->isIdenticalTo($builder)271 ->boolean($builder->unitTestCheckingIsEnabled())->isTrue()272 ;273 }274 public function testCheckUnitTests()275 {276 $builder = new \mock\mageekguy\atoum\scripts\builder(uniqid(), $adapter = new atoum\test\adapter());277 $builder->disableUnitTestChecking();278 $this->assert279 ->boolean($builder->unitTestCheckingIsEnabled())->isFalse()280 ->boolean($builder->checkUnitTests())->isTrue()281 ;282 $builder->enableUnitTestChecking();283 $this->assert284 ->exception(function() use ($builder) {285 $builder->checkUnitTests();286 }287 )288 ->isInstanceOf('mageekguy\atoum\exceptions\logic')289 ->hasMessage('Unable to check unit tests, working directory is undefined')290 ;291 $builder->setWorkingDirectory($workingDirectory = uniqid());292 $vcsController = new mock\controller();293 $vcsController->__construct = function() {};294 $vcsController->exportRepository = function() {};295 $builder->setVcs($vcs = new \mock\mageekguy\atoum\scripts\builder\vcs(null, $vcsController));296 $builder297 ->setUnitTestRunnerScript($unitTestRunnerScript = uniqid())298 ->setPhpPath($php = uniqid())299 ->setReportTitle($reportTitle = uniqid())300 ->addRunnerConfigurationFile($runnerConfigurationFile = uniqid())301 ;302 $score = new \mock\mageekguy\atoum\score();303 $scoreController = $score->getMockController();304 $scoreController->getFailNumber = 0;305 $scoreController->getExceptionNumber = 0;306 $scoreController->getErrorNumber = 0;307 $adapter->sys_get_temp_dir = $tempDirectory = uniqid();308 $adapter->tempnam = $scoreFile = uniqid();309 $adapter->proc_open = function($bin, $descriptors, & $stream) use (& $stdOut, & $stdErr, & $pipes, & $resource) { $pipes = array(1 => $stdOut = uniqid(), 2 => $stdErr = uniqid()); $stream = $pipes; return ($resource = uniqid()); };310 $adapter->proc_get_status = array('exit_code' => 0, 'running' => true);311 $adapter->stream_get_contents = function() { return ''; };312 $adapter->fclose = function() {};313 $adapter->proc_close = function() {};314 $adapter->file_get_contents = $scoreFileContents = uniqid();315 $adapter->unserialize = $score;316 $adapter->unlink = true;317 $command = escapeshellarg($php) . ' ' . escapeshellarg($workingDirectory . \DIRECTORY_SEPARATOR . $unitTestRunnerScript) . ' -drt ' . escapeshellarg($reportTitle) . ' -ncc -sf ' . escapeshellarg($scoreFile) . ' -d ' . escapeshellarg($workingDirectory . \DIRECTORY_SEPARATOR . 'tests' . \DIRECTORY_SEPARATOR . 'units' . \DIRECTORY_SEPARATOR . 'classes') . ' -p ' . escapeshellarg($php) . ' -c ' . escapeshellarg($runnerConfigurationFile);318 $builderController = $builder->getMockController();319 $builderController->writeErrorInErrorsDirectory = function() {};320 $this->assert321 ->boolean($builder->checkUnitTests())->isTrue()322 ->mock($vcs)323 ->call('setWorkingDirectory')324 ->withArguments($workingDirectory)325 ->once()326 ->mock($vcs)327 ->call('exportRepository')->once()328 ->adapter($adapter)329 ->call('sys_get_temp_dir')->once()330 ->call('tempnam')->withArguments($tempDirectory, '')->once()331 ->call('proc_open')->withArguments($command, array(1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes)->once()332 ->call('proc_get_status')->withArguments($resource)->once()333 ->call('stream_get_contents')->withArguments($stdOut)->once()334 ->call('fclose')->withArguments($stdOut)->once()335 ->call('stream_get_contents')->withArguments($stdErr)->once()336 ->call('fclose')->withArguments($stdErr)->once()337 ->call('proc_close')->withArguments($resource)->once()338 ->call('file_get_contents')->withArguments($scoreFile)->once()339 ->call('unserialize')->withArguments($scoreFileContents)->once()340 ->call('unlink')->withArguments($scoreFile)->once()341 ->mock($score)342 ->call('getFailNumber')->once()343 ->call('getExceptionNumber')->once()344 ->call('getErrorNumber')->once()345 ;346 $adapter->proc_open = false;347 $this->assert348 ->boolean($builder->checkUnitTests())->isFalse()349 ->mock($builder)350 ->call('writeErrorInErrorsDirectory')->withArguments('Unable to execute \'' . $command . '\'')351 ->once()352 ;353 $adapter->proc_open = function($bin, $descriptors, & $stream) use (& $stdOut, & $stdErr, & $pipes, & $resource) { $pipes = array(1 => $stdOut = uniqid(), 2 => $stdErr = uniqid()); $stream = $pipes; return ($resource = uniqid()); };354 $adapter->proc_get_status = array('exitcode' => 126, 'running' => false);355 $this->assert356 ->boolean($builder->checkUnitTests())->isFalse()357 ->mock($builder)358 ->call('writeErrorInErrorsDirectory')359 ->withArguments('Unable to find \'' . $php . '\' or it is not executable')360 ->once()361 ;362 $adapter->proc_get_status = array('exitcode' => 127, 'running' => false);363 $this->assert364 ->boolean($builder->checkUnitTests())->isFalse()365 ->mock($builder)366 ->call('writeErrorInErrorsDirectory')367 ->withArguments('Unable to find \'' . $php . '\' or it is not executable')368 ->once()369 ;370 $adapter->proc_get_status = array('exitcode' => $exitCode = rand(1, 125), 'running' => false);371 $this->assert372 ->boolean($builder->checkUnitTests())->isFalse()373 ->mock($builder)374 ->call('writeErrorInErrorsDirectory')375 ->withArguments('Command \'' . $command . '\' failed with exit code \'' . $exitCode . '\'')376 ->once()377 ;378 $adapter->proc_get_status = array('exitcode' => $exitCode = rand(128, PHP_INT_MAX), 'running' => false);379 $this->assert380 ->boolean($builder->checkUnitTests())->isFalse()381 ->mock($builder)382 ->call('writeErrorInErrorsDirectory')383 ->withArguments('Command \'' . $command . '\' failed with exit code \'' . $exitCode . '\'')384 ->once()385 ;386 $adapter->proc_get_status = array('exit_code' => 0, 'running' => true);387 $adapter->stream_get_contents = function($stream) use (& $stdOut, & $stdOutContents) { return $stream != $stdOut ? '' : $stdOutContents = uniqid(); };388 $this->assert389 ->boolean($builder->checkUnitTests())->isTrue()390 ->mock($builder)391 ->call('writeErrorInErrorsDirectory')392 ->withArguments($stdOutContents)393 ->never()394 ;395 $adapter->stream_get_contents = function($stream) use (& $stdErr, & $stdErrContents) { return $stream != $stdErr ? '' : $stdErrContents = uniqid(); };396 $this->assert397 ->boolean($builder->checkUnitTests())->isFalse()398 ->mock($builder)399 ->call('writeErrorInErrorsDirectory')400 ->withArguments($stdErrContents)401 ->once()402 ;403 $adapter->stream_get_contents = '';404 $adapter->file_get_contents = false;405 $builder->getMockController()->resetCalls();406 $this->assert407 ->boolean($builder->checkUnitTests())->isFalse()408 ->mock($builder)409 ->call('writeErrorInErrorsDirectory')410 ->withArguments('Unable to read score from file \'' . $scoreFile . '\'')411 ->once()412 ;413 $adapter->file_get_contents = $scoreFileContents;414 $adapter->unserialize = false;415 $this->assert416 ->boolean($builder->checkUnitTests())->isFalse()417 ->mock($builder)418 ->call('writeErrorInErrorsDirectory')419 ->withArguments('Unable to unserialize score from file \'' . $scoreFile . '\'')420 ->once()421 ;422 $adapter->unserialize = uniqid();423 $this->assert424 ->boolean($builder->checkUnitTests())->isFalse()425 ->mock($builder)426 ->call('writeErrorInErrorsDirectory')427 ->withArguments('Contents of file \'' . $scoreFile . '\' is not a score')428 ->once()429 ;430 $adapter->unserialize = $score;431 $adapter->unlink = false;432 $this->assert433 ->exception(function() use ($builder) {434 $builder->checkUnitTests();435 }436 )437 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')438 ->hasMessage('Unable to delete score file \'' . $scoreFile . '\'')439 ;440 $adapter->unlink = true;441 $scoreController->getFailNumber = rand(1, PHP_INT_MAX);442 $this->assert443 ->boolean($builder->checkUnitTests())->isFalse()444 ;445 $scoreController->getFailNumber = 0;446 $scoreController->getExceptionNumber = rand(1, PHP_INT_MAX);447 $this->assert448 ->boolean($builder->checkUnitTests())->isFalse()449 ;450 $scoreController->getExceptionNumber = 0;451 $scoreController->getErrorNumber = rand(1, PHP_INT_MAX);452 $this->assert453 ->boolean($builder->checkUnitTests())->isFalse()454 ;455 }456 public function testDisablePharCreation()457 {458 $builder = new scripts\builder(uniqid());459 $this->assert460 ->boolean($builder->pharCreationIsEnabled())->isTrue()461 ->object($builder->disablePharCreation())->isIdenticalTo($builder)462 ->boolean($builder->pharCreationIsEnabled())->isFalse()463 ;464 }465 public function testEnablePharCreation()466 {467 $builder = new scripts\builder(uniqid());468 $builder->disablePharCreation();469 $this->assert470 ->boolean($builder->pharCreationIsEnabled())->isFalse()471 ->object($builder->enablePharCreation())->isIdenticalTo($builder)472 ->boolean($builder->pharCreationIsEnabled())->isTrue()473 ;474 }475 public function testCreatePhar()476 {477 $builder = new \mock\mageekguy\atoum\scripts\builder(uniqid(), $adapter = new atoum\test\adapter());478 $builder479 ->setTaggerEngine($taggerEngine = new \mock\mageekguy\atoum\scripts\tagger\engine())480 ->disablePharCreation()481 ;482 $taggerEngine->getMockController()->tagVersion = function() {};483 $this->assert484 ->boolean($builder->createPhar())->isTrue()485 ;486 $builder->enablePharCreation();487 $vcsController = new mock\controller();488 $vcsController->__construct = function() {};489 $vcsController->getNextRevisions = array();490 $vcsController->exportRepository = function() {};491 $builder->setVcs($vcs = new \mock\mageekguy\atoum\scripts\builder\vcs(null, $vcsController));492 $this->assert493 ->exception(function() use ($builder) {494 $builder->createPhar();495 }496 )497 ->isInstanceOf('mageekguy\atoum\exceptions\logic')498 ->hasMessage('Unable to create phar, destination directory is undefined')499 ;500 $builder->setDestinationDirectory($destinationDirectory = uniqid());501 $this->assert502 ->exception(function() use ($builder) {503 $builder->createPhar();504 }505 )506 ->isInstanceOf('mageekguy\atoum\exceptions\logic')507 ->hasMessage('Unable to create phar, working directory is undefined')508 ;509 $builder->setWorkingDirectory($workingDirectory = uniqid());510 $builder511 ->setPhpPath($php = uniqid())512 ->setPharGeneratorScript($pharGeneratorScript = uniqid())513 ;514 $builderController = $builder->getMockController();515 $builderController->writeErrorInErrorsDirectory = function() {};516 $adapter->file_get_contents = false;517 $this->assert518 ->boolean($builder->createPhar())->isTrue()519 ;520 $vcsController->getNextRevisions = function() use (& $revision) { static $i = 0; return ++$i > 1 ? array() : array($revision = rand(1, PHP_INT_MAX)); };521 $builder->disableUnitTestChecking();522 $adapter->proc_open = false;523 $this->assert524 ->boolean($builder->createPhar())->isFalse()525 ->mock($builder)526 ->call('writeErrorInErrorsDirectory')527 ->withArguments('Unable to execute \'' . escapeshellarg($php) . ' -d phar.readonly=0 -f ' . escapeshellarg($workingDirectory . \DIRECTORY_SEPARATOR . $pharGeneratorScript) . ' -- -d ' . escapeshellarg($destinationDirectory) . '\'')528 ->once()529 ->mock($vcs)530 ->call('setRevision')->withArguments($revision)->once()531 ->call('setWorkingDirectory')->withArguments($workingDirectory)->once()532 ->call('exportRepository')->once()533 ;534 $adapter->proc_open = function($bin, $descriptors, & $stream) use (& $stdErr, & $pipes, & $resource) { $pipes = array(2 => $stdErr = uniqid()); $stream = $pipes; return ($resource = uniqid()); };535 $adapter->stream_get_contents = function() { return ''; };536 $adapter->fclose = function() {};537 $adapter->proc_close = function() {};538 $adapter->date = $date = uniqid();539 $vcsController->resetCalls()->getNextRevisions = function() use (& $revision) { static $i = 0; return ++$i > 1 ? array() : array($revision = rand(1, PHP_INT_MAX)); };540 $this->assert541 ->boolean($builder->createPhar())->isTrue()542 ->mock($taggerEngine)543 ->call('setVersion')544 ->withArguments('nightly-' . $revision . '-' . $date)545 ->once()546 ->call('tagVersion')->atLeastOnce()547 ->adapter($adapter)548 ->call('proc_open')->withArguments(escapeshellarg($php) . ' -d phar.readonly=0 -f ' . escapeshellarg($workingDirectory . \DIRECTORY_SEPARATOR . $pharGeneratorScript) . ' -- -d ' . escapeshellarg($destinationDirectory), array(2 => array('pipe', 'w')), $pipes)->once()549 ->call('stream_get_contents')->withArguments($stdErr)->once()550 ->call('fclose')->withArguments($stdErr)->once()551 ->call('proc_close')->withArguments($resource)->once()552 ->call('date')->withArguments('YmdHi')->atLeastOnce()553 ->mock($vcs)554 ->call('setRevision')->withArguments($revision)->once()555 ->call('setWorkingDirectory')->withArguments($workingDirectory)->once()556 ->call('exportRepository')->once()557 ;558 $adapter->resetCalls();559 $builder->getMockController()->resetCalls();560 $vcsController->resetCalls()->getNextRevisions = function() use (& $revision) { static $i = 0; return ++$i > 1 ? array() : array($revision = rand(1, PHP_INT_MAX)); };561 $this->assert562 ->boolean($builder->createPhar($tag = uniqid()))->isTrue()563 ->mock($taggerEngine)564 ->call('setVersion')->withArguments($tag)->once()565 ->call('tagVersion')->once()566 ->adapter($adapter)567 ->call('proc_open')->withArguments(escapeshellarg($php) . ' -d phar.readonly=0 -f ' . escapeshellarg($workingDirectory . \DIRECTORY_SEPARATOR . $pharGeneratorScript) . ' -- -d ' . escapeshellarg($destinationDirectory), array(2 => array('pipe', 'w')), $pipes)->once()568 ->call('stream_get_contents')->withArguments($stdErr)->once()569 ->call('fclose')->withArguments($stdErr)->once()570 ->call('proc_close')->withArguments($resource)->once()571 ->call('date')->never()572 ->mock($vcs)573 ->call('setRevision')->withArguments($revision)->once()574 ->call('setWorkingDirectory')->withArguments($workingDirectory)->once()575 ->call('exportRepository')->once()576 ;577 $adapter->resetCalls();578 $builder->getMockController()->resetCalls();579 $vcsController->resetCalls()->getNextRevisions = function() use (& $revision) { static $i = 0; return ++$i > 1 ? array() : array($revision = rand(1, PHP_INT_MAX)); };580 $adapter->stream_get_contents = function() use (& $stdErrContents) { return $stdErrContents = uniqid(); };581 $this->assert582 ->boolean($builder->createPhar())->isFalse()583 ->adapter($adapter)584 ->call('proc_open')->withArguments(escapeshellarg($php) . ' -d phar.readonly=0 -f ' . escapeshellarg($workingDirectory . \DIRECTORY_SEPARATOR . $pharGeneratorScript) . ' -- -d ' . escapeshellarg($destinationDirectory), array(2 => array('pipe', 'w')), $pipes)->once()585 ->call('stream_get_contents')->withArguments($stdErr)->once()586 ->call('fclose')->withArguments($stdErr)->once()587 ->call('proc_close')->withArguments($resource)->once()588 ->mock($builder)589 ->call('writeErrorInErrorsDirectory')590 ->withArguments($stdErrContents)591 ->once()592 ->mock($vcs)593 ->call('setRevision')->withArguments($revision)->once()594 ->call('setWorkingDirectory')->withArguments($workingDirectory)->once()595 ->call('exportRepository')->once()596 ;597 $builder->setRevisionFile($revisionFile = uniqid());598 $adapter->stream_get_contents = function() { return ''; };599 $adapter->file_get_contents = false;600 $adapter->file_put_contents = function() {};601 $vcsController->resetCalls()->getNextRevisions = function() use (& $revision) { static $i = 0; return ++$i > 1 ? array() : array($revision = rand(1, PHP_INT_MAX)); };602 $this->assert603 ->boolean($builder->createPhar())->isTrue()604 ->adapter($adapter)605 ->call('file_get_contents')->withArguments($revisionFile)->once()606 ->call('proc_open')->withArguments(escapeshellarg($php) . ' -d phar.readonly=0 -f ' . escapeshellarg($workingDirectory . \DIRECTORY_SEPARATOR . $pharGeneratorScript) . ' -- -d ' . escapeshellarg($destinationDirectory), array(2 => array('pipe', 'w')), $pipes)->once()607 ->call('stream_get_contents')->withArguments($stdErr)->once()608 ->call('fclose')->withArguments($stdErr)->once()609 ->call('proc_close')->withArguments($resource)->once()610 ->mock($vcs)611 ->call('setRevision')->withArguments($revision)->once()612 ->call('setWorkingDirectory')->withArguments($workingDirectory)->once()613 ->call('exportRepository')->once()614 ;615 $adapter->file_get_contents = false;616 $adapter->file_put_contents = function() {};617 $vcsController->resetCalls()->getNextRevisions = function() use (& $revision) { static $i = 0; return ++$i > 1 ? array() : array($revision = rand(1, PHP_INT_MAX)); };618 $this->assert619 ->boolean($builder->createPhar())->isTrue()620 ->adapter($adapter)621 ->call('file_get_contents')->withArguments($revisionFile)->once()622 ->call('proc_open')->withArguments(escapeshellarg($php) . ' -d phar.readonly=0 -f ' . escapeshellarg($workingDirectory . \DIRECTORY_SEPARATOR . $pharGeneratorScript) . ' -- -d ' . escapeshellarg($destinationDirectory), array(2 => array('pipe', 'w')), $pipes)->once()623 ->call('stream_get_contents')->withArguments($stdErr)->once()624 ->call('fclose')->withArguments($stdErr)->once()625 ->call('proc_close')->withArguments($resource)->once()626 ->call('file_put_contents')->withArguments($revisionFile, $revision, \LOCK_EX)->once()627 ->mock($vcs)628 ->call('setRevision')->withArguments($revision)->once()629 ->call('setWorkingDirectory')->withArguments($workingDirectory)->once()630 ->call('exportRepository')->once()631 ;632 $vcsController->resetCalls()->getNextRevisions = function() use (& $revision) { static $i = 0; return ++$i > 1 ? array() : array($revision = rand(1, PHP_INT_MAX)); };633 $adapter->file_put_contents = false;634 $this->assert635 ->exception(function() use ($builder) {636 $builder->createPhar();637 }638 )639 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')640 ->hasMessage('Unable to save last revision in file \'' . $revisionFile . '\'')641 ;642 $vcsController->resetCalls();643 $vcsController->getNextRevisions[1] = array(1, 2, 3);644 $vcsController->getNextRevisions[2] = array(2, 3);645 $vcsController->getNextRevisions[3] = array(3);646 $vcsController->getNextRevisions[4] = array();647 $adapter->file_put_contents = function() {};648 $this->assert649 ->boolean($builder->createPhar())->isTrue()650 ->adapter($adapter)651 ->call('file_get_contents')->withArguments($revisionFile)->once()652 ->call('proc_open')->withArguments(escapeshellarg($php) . ' -d phar.readonly=0 -f ' . escapeshellarg($workingDirectory . \DIRECTORY_SEPARATOR . $pharGeneratorScript) . ' -- -d ' . escapeshellarg($destinationDirectory), array(2 => array('pipe', 'w')), $pipes)->exactly(3)653 ->call('stream_get_contents')->withArguments($stdErr)->once()654 ->call('fclose')->withArguments($stdErr)->once()655 ->call('proc_close')->withArguments($resource)->once()656 ->call('file_put_contents')->withArguments($revisionFile, 3, \LOCK_EX)->once()657 ->mock($vcs)658 ->call('setRevision')->withArguments(1)->once()659 ->call('setRevision')->withArguments(2)->once()660 ->call('setRevision')->withArguments(3)->once()661 ->call('setWorkingDirectory')->withArguments($workingDirectory)->atLeastOnce()662 ->call('exportRepository')->atLeastOnce()663 ;664 $vcsController->resetCalls();665 $vcsController->getNextRevisions[1] = array(4);666 $vcsController->getNextRevisions[2] = array();667 $adapter->file_get_contents = 1;668 $this->assert669 ->boolean($builder->createPhar())->isTrue()670 ->adapter($adapter)671 ->call('file_get_contents')->withArguments($revisionFile)->once()672 ->call('proc_open')->withArguments(escapeshellarg($php) . ' -d phar.readonly=0 -f ' . escapeshellarg($workingDirectory . \DIRECTORY_SEPARATOR . $pharGeneratorScript) . ' -- -d ' . escapeshellarg($destinationDirectory), array(2 => array('pipe', 'w')), $pipes)->once()673 ->call('stream_get_contents')->withArguments($stdErr)->once()674 ->call('fclose')->withArguments($stdErr)->once()675 ->call('proc_close')->withArguments($resource)->once()676 ->call('file_put_contents')->withArguments($revisionFile, 4, \LOCK_EX)->once()677 ->mock($vcs)678 ->call('setRevision')->withArguments(4)->once()679 ->call('setWorkingDirectory')->withArguments($workingDirectory)->once()680 ->call('exportRepository')->once()681 ;682 }683 public function testRun()684 {685 $adapter = new atoum\test\adapter();686 $adapter->file_get_contents = false;687 $adapter->fopen = $runFileResource = uniqid();688 $adapter->flock = true;689 $adapter->getmypid = $pid = uniqid();690 $adapter->fwrite = function() {};691 $adapter->fclose = function() {};692 $adapter->unlink = function() {};693 $builder = new \mock\mageekguy\atoum\scripts\builder(uniqid(), $adapter);694 $builderController = $builder->getMockController();695 $builderController->createPhar = function() {};696 $builder->setRunFile($runFile = uniqid());697 $this->assert698 ->object($builder->run())->isIdenticalTo($builder)699 ->mock($builder)->call('createPhar')->once()700 ->adapter($adapter)701 ->call('file_get_contents')->withArguments($runFile)->once()702 ->call('fopen')->withArguments($runFile, 'w+')->once()703 ->call('flock')->withArguments($runFileResource, \LOCK_EX | \LOCK_NB)->once()704 ->call('fwrite')->withArguments($runFileResource, $pid)->once()705 ->call('fclose')->withArguments($runFileResource)->once()706 ->call('unlink')->withArguments($runFile)->once()707 ;708 }709 public function testWriteInErrorDirectory()710 {711 $this712 ->if($adapter = new atoum\test\adapter())713 ->and($adapter->file_put_contents = function() {})714 ->and($builder = new scripts\builder(uniqid(), $adapter))715 ->then716 ->variable($builder->getErrorsDirectory())->isNull()717 ->object($builder->writeErrorInErrorsDirectory(uniqid()))->isIdenticalTo($builder)718 ->adapter($adapter)->call('file_put_contents')->never()719 ->if($builder->setErrorsDirectory($errorDirectory = uniqid()))720 ->then721 ->string($builder->getErrorsDirectory())->isEqualTo($errorDirectory)722 ->exception(function() use ($builder) {723 $builder->writeErrorInErrorsDirectory(uniqid());724 }725 )726 ->isInstanceOf('mageekguy\atoum\exceptions\logic')727 ->hasMessage('Revision is undefined')728 ->adapter($adapter)->call('file_put_contents')->never()729 ;730 $vcsController = new mock\controller();731 $vcsController->__construct = function() {};732 $builder->setVcs($vcs = new \mock\mageekguy\atoum\scripts\builder\vcs(null, $vcsController));733 $vcs->setRevision($revision = rand(1, PHP_INT_MAX));734 $this->assert735 ->string($builder->getErrorsDirectory())->isEqualTo($errorDirectory)736 ->object($builder->writeErrorInErrorsDirectory($message = uniqid()))->isIdenticalTo($builder)737 ->adapter($adapter)->call('file_put_contents')->withArguments($errorDirectory . \DIRECTORY_SEPARATOR . $revision, $message, \LOCK_EX | \FILE_APPEND)->once()738 ;739 $adapter740 ->resetCalls()741 ->file_put_contents = false742 ;743 $this->assert744 ->string($builder->getErrorsDirectory())->isEqualTo($errorDirectory)745 ->exception(function() use ($builder, & $message) {746 $builder->writeErrorInErrorsDirectory($message = uniqid());747 }...
setRevision
Using AI Code Generation
1$version = new vcs();2$version->setRevision('1.2');3echo $version->getRevision();4$version = new vcs();5$version->setRevision('1.3');6echo $version->getRevision();7{8 private $revision = '1.0';9 public function setRevision($rev)10 {11 $this->revision = $rev;12 }13 public function getRevision()14 {15 return $this->revision;16 }17}18$version = new vcs();19$version->setRevision('1.2');20echo $version->getRevision();21$version = new vcs();22$version->setRevision('1.3');23echo $version->getRevision();24The static keyword is used to define the static properties and methods of a class. Static properties and methods are not associated with any particular object. They are associated with the class itself. Static properties and methods are accessed using the class name and double colon (::) operator. The syntax of static properties and methods is:-25static $property_name;26static function method_name()27static $property_name;
setRevision
Using AI Code Generation
1$revision = "1.1";2$vcs->setRevision($revision);3$revision = "1.2";4$vcs->setRevision($revision);5$revision = "1.3";6$vcs->setRevision($revision);7$revision = "1.4";8$vcs->setRevision($revision);9$revision = "1.5";10$vcs->setRevision($revision);11$revision = "1.6";12$vcs->setRevision($revision);13$revision = "1.7";14$vcs->setRevision($revision);15$revision = "1.8";16$vcs->setRevision($revision);17$revision = "1.9";18$vcs->setRevision($revision);19$revision = "1.10";20$vcs->setRevision($revision);21$revision = "1.11";22$vcs->setRevision($revision);
setRevision
Using AI Code Generation
1$vcs = new vcs();2$vcs->setRevision("1.1");3$vcs->setRevision("1.2");4$vcs->setRevision("1.3");5$vcs->setRevision("1.4");6$vcs->setRevision("1.5");7$vcs->setRevision("1.6");8$vcs->setRevision("1.7");9$vcs->setRevision("1.8");10$vcs->setRevision("1.9");11$vcs->setRevision("1.10");12$vcs->setRevision("1.11");13$vcs->setRevision("1.12");14$vcs->setRevision("1.13");15$vcs->setRevision("1.14");16$vcs->setRevision("1.15");17$vcs->setRevision("1.16");18$vcs->setRevision("1.17");19$vcs->setRevision("1.18");20$vcs->setRevision("1.19");21$vcs->setRevision("1.20");22$vcs->setRevision("1.21");23$vcs->setRevision("1.22");24$vcs->setRevision("1
setRevision
Using AI Code Generation
1require_once('vcs.php');2$vcs = new vcs();3$vcs->setRevision('1.1');4$vcs->setFileName('1.php');5$vcs->setRepository('cvs');6$vcs->setRepositoryPath('/home/cvs');7echo $vcs->getFileContent();8require_once('vcs.php');9$vcs = new vcs();10$vcs->setRevision('1.1');11$vcs->setFileName('1.php');12$vcs->setRepository('svn');13$vcs->setRepositoryPath('/home/svn');14echo $vcs->getFileContent();15require_once('vcs.php');16$vcs = new vcs();17$vcs->setRevision('1.1');18$vcs->setFileName('1.php');19$vcs->setRepository('git');20$vcs->setRepositoryPath('/home/git');21echo $vcs->getFileContent();22require_once('vcs.php');23$vcs = new vcs();24$vcs->setRevision('1.1');25$vcs->setFileName('1.php');26$vcs->setRepository('bzr');27$vcs->setRepositoryPath('/home/bzr');28echo $vcs->getFileContent();29require_once('vcs.php');
setRevision
Using AI Code Generation
1require_once 'vcs.php';2$vcs = new vcs();3$vcs->setRevision(1);4require_once 'vcs.php';5$vcs = new vcs();6echo $vcs->getRevision();7require_once 'vcs.php';8$vcs = new vcs();9echo $vcs->getRevision();10require_once 'vcs.php';11$vcs = new vcs();12echo $vcs->getRevision();13require_once 'vcs.php';14$vcs = new vcs();15echo $vcs->getRevision();16require_once 'vcs.php';17$vcs = new vcs();18echo $vcs->getRevision();19require_once 'vcs.php';20$vcs = new vcs();21echo $vcs->getRevision();22require_once 'vcs.php';23$vcs = new vcs();24echo $vcs->getRevision();25require_once 'vcs.php';26$vcs = new vcs();27echo $vcs->getRevision();28require_once 'vcs.php';29$vcs = new vcs();30echo $vcs->getRevision();31require_once 'vcs.php';32$vcs = new vcs();33echo $vcs->getRevision();
setRevision
Using AI Code Generation
1require_once 'vcs.php';2$repo->setRevision('trunk','1');3require_once 'vcs.php';4echo $repo->getRevision('trunk');5require_once 'vcs.php';6echo $repo->getRevision('trunk');
setRevision
Using AI Code Generation
1$vcs->setRevision($revision);2$revision = $vcs->getRevision();3$revision = $vcs->getRevision();4$revision = $vcs->getRevision();5$revision = $vcs->getRevision();6$revision = $vcs->getRevision();7$revision = $vcs->getRevision();
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with setRevision on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!