How to use getWorkingDirectory method of pusher class

Best Atoum code snippet using pusher.getWorkingDirectory

pusher.php

Source:pusher.php Github

copy

Full Screen

...28 ->then29 ->string($pusher->getRemote())->isEqualTo(testedClass::defaultRemote)30 ->string($pusher->getTagFile())->isEqualTo(__DIR__ . DIRECTORY_SEPARATOR . testedClass::defaultTagFile)31 ->object($pusher->getTaggerEngine())->isEqualTo(new scripts\tagger\engine())32 ->string($pusher->getWorkingDirectory())->isEqualTo(getcwd())33 ->object($pusher->getGit())->isEqualTo(new commands\git())34 ;35 }36 public function testSetRemote()37 {38 $this39 ->if($pusher = new testedClass(__FILE__))40 ->then41 ->object($pusher->setRemote($remote = uniqid()))->isIdenticalTo($pusher)42 ->string($pusher->getRemote())->isEqualTo($remote)43 ->object($pusher->setRemote())->isIdenticalTo($pusher)44 ->string($pusher->getRemote())->isEqualTo(testedClass::defaultRemote)45 ;46 }47 public function testSetTagFile()48 {49 $this50 ->if($pusher = new testedClass(__FILE__))51 ->then52 ->object($pusher->setTagFile($tagFile = uniqid()))->isIdenticalTo($pusher)53 ->string($pusher->getTagFile())->isEqualTo($tagFile)54 ->object($pusher->setTagFile())->isIdenticalTo($pusher)55 ->string($pusher->getTagFile())->isEqualTo(__DIR__ . DIRECTORY_SEPARATOR . testedClass::defaultTagFile)56 ;57 }58 public function testSetTaggerEngine()59 {60 $this61 ->if($pusher = new testedClass(__FILE__))62 ->then63 ->object($pusher->setTaggerEngine($taggerEngine = new scripts\tagger\engine()))->isIdenticalTo($pusher)64 ->object($pusher->getTaggerEngine())->isIdenticalTo($taggerEngine)65 ->object($pusher->setTaggerEngine())->isIdenticalTo($pusher)66 ->object($pusher->getTaggerEngine())67 ->isNotIdenticalTo($taggerEngine)68 ->isEqualTo(new scripts\tagger\engine())69 ;70 }71 public function testSetWorkingDirectory()72 {73 $this74 ->if($pusher = new testedClass(__FILE__))75 ->then76 ->object($pusher->setWorkingDirectory($workingDirectory = uniqid()))->isIdenticalTo($pusher)77 ->string($pusher->getWorkingDirectory())->isEqualTo($workingDirectory)78 ->object($pusher->setWorkingDirectory())->isIdenticalTo($pusher)79 ->string($pusher->getWorkingDirectory())->isEqualTo(getcwd())80 ;81 }82 public function testSetGit()83 {84 $this85 ->if($pusher = new testedClass(__FILE__))86 ->then87 ->object($pusher->setGit($git = new commands\git()))->isIdenticalTo($pusher)88 ->object($pusher->getGit())->isIdenticalTo($git)89 ->object($pusher->setGit())->isIdenticalTo($pusher)90 ->object($pusher->getGit())91 ->isNotIdenticalTo($git)92 ->isEqualTo(new commands\git())93 ;94 }95 public function testRun()96 {97 $this98 ->given(99 $pusher = new testedClass(__FILE__),100 $pusher->setTaggerEngine($taggerEngine = new \mock\mageekguy\atoum\scripts\tagger\engine()),101 $pusher->setGit($git = new \mock\mageekguy\atoum\cli\commands\git()),102 $pusher->setForceMode(true),103 $pusher->setErrorWriter($errorWriter = new \mock\mageekguy\atoum\writers\std\err()),104 $pusher->setInfoWriter($infoWriter = new \mock\mageekguy\atoum\writers\std\out()),105 $this->calling($infoWriter)->write = $infoWriter106 )107 ->assert('Pusher should write error if tag file is not readable')108 ->if(109 $this->calling($errorWriter)->write = $errorWriter,110 $this->function->file_get_contents = false111 )112 ->then113 ->object($pusher->run())->isIdenticalTo($pusher)114 ->mock($errorWriter)->call('write')->withArguments('Unable to read \'' . $pusher->getTagFile() . '\'')->once()115 ->assert('Pusher should write error if tag file is not writable')116 ->if(117 $this->calling($errorWriter)->write = $errorWriter,118 $this->function->file_put_contents = false,119 $this->function->file_get_contents = '0.0.0'120 )121 ->then122 ->object($pusher->run())->isIdenticalTo($pusher)123 ->mock($errorWriter)->call('write')->withArguments('Unable to write in \'' . $pusher->getTagFile() . '\'')->once()124 ->assert('Pusher should tag code and commit it if tag file is writable')125 ->if(126 $this->function->file_put_contents = function($path, $data) { return strlen($data); },127 $this->calling($taggerEngine)->tagVersion->doesNothing(),128 $this->calling($git)->addAllAndCommit = $git,129 $this->calling($git)->checkoutAllFiles = $git,130 $this->calling($git)->createTag = $git,131 $this->calling($git)->push = $git,132 $this->calling($git)->forcePush = $git,133 $this->calling($git)->pushTag = $git,134 $this->calling($git)->resetHardTo = $git,135 $this->calling($git)->deleteLocalTag = $git136 )137 ->then138 ->object($pusher->run())->isIdenticalTo($pusher)139 ->function('file_put_contents')->wasCalledWithArguments($pusher->getTagFile(), '0.0.1')->once()140 ->mock($taggerEngine)141 ->call('tagVersion')142 ->before($this->mock($git)143 ->call('addAllAndCommit')->withArguments('Set version to 0.0.1.')144 ->before($this->mock($git)145 ->call('createTag')->withArguments('0.0.1')146 ->before($this->mock($git)147 ->call('push')->withArguments($pusher->getRemote())148 ->once()149 )150 ->before($this->mock($git)151 ->call('pushTag')->withArguments('0.0.1', $pusher->getRemote())152 ->once()153 )154 ->once()155 )156 ->once())157 ->after($this->mock($taggerEngine)158 ->call('setSrcDirectory')->withArguments($pusher->getWorkingDirectory())159 ->once()160 )161 ->after($this->mock($taggerEngine)162 ->call('setVersion')->withArguments('$Rev:' . ' 0.0.1 $') // Don't remove concatenation operator to avoid tagger replace the string.163 ->once()164 )165 ->once()166 ->call('tagVersion')167 ->before($this->mock($git)168 ->call('addAllAndCommit')->withArguments('Set version to dev-master.')->once())169 ->after($this->mock($taggerEngine)->call('setSrcDirectory')->withArguments($pusher->getWorkingDirectory())->once())170 ->after($this->mock($taggerEngine)->call('setVersion')->withArguments('$Rev:' . ' dev-master $')->once()) // Don't remove concatenation operator to avoid tagger replace the string.171 ->once()172 ->if($pusher->tagPatchVersion())173 ->then174 ->object($pusher->run())->isIdenticalTo($pusher)175 ->function('file_put_contents')->wasCalledWithArguments($pusher->getTagFile(), '0.0.1')->twice()176 ->if($pusher->tagMinorVersion())177 ->then178 ->object($pusher->run())->isIdenticalTo($pusher)179 ->function('file_put_contents')->wasCalledWithArguments($pusher->getTagFile(), '0.1.0')->once()180 ->if($pusher->tagMajorVersion())181 ->then182 ->object($pusher->run())->isIdenticalTo($pusher)183 ->function('file_put_contents')->wasCalledWithArguments($pusher->getTagFile(), '1.0.0')->once()...

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 getWorkingDirectory code on LambdaTest Cloud Grid

Execute automation tests with getWorkingDirectory 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