当前位置: 首页>>代码示例>>PHP>>正文


PHP Result::stopOnFail方法代码示例

本文整理汇总了PHP中Robo\Result::stopOnFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Result::stopOnFail方法的具体用法?PHP Result::stopOnFail怎么用?PHP Result::stopOnFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Robo\Result的用法示例。


在下文中一共展示了Result::stopOnFail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testStopOnFail

 public function testStopOnFail()
 {
     $exceptionClass = false;
     $task = new ResultDummyTask();
     Result::$stopOnFail = true;
     $result = Result::success($task, "Something that worked");
     try {
         $result = Result::error($task, "Something that did not work");
         // stopOnFail will cause Result::error() to throw an exception,
         // so we will never get here. If we did, the assert below would fail.
         $this->assertTrue($result->wasSuccessful());
         $this->assertTrue(false);
     } catch (\Exception $e) {
         $exceptionClass = get_class($e);
     }
     $this->assertEquals(TaskExitException::class, $exceptionClass);
     $this->assertTrue($result->wasSuccessful());
     /*
     // This gives an error:
     //    Exception of class Robo\Exception\TaskExitException expected to
     //    be thrown, but PHPUnit_Framework_Exception caught
     // This happens whether or not the expected exception is thrown
     $this->guy->expectException(TaskExitException::class, function() {
         // $result = Result::error($task, "Something that did not work");
         $result = Result::success($task, "Something that worked");
     });
     */
     Result::$stopOnFail = false;
 }
开发者ID:jjok,项目名称:Robo,代码行数:29,代码来源:ResultTest.php

示例2: execute

 function execute($opts)
 {
     $answer = $this->ask("Bulding Docker container takes some time, you can use already provisioned image instead.\nDo you want to continue? (y/n)");
     if (trim(strtolower($answer)) != 'y') {
         return;
     }
     Result::$stopOnFail = true;
     $recipes = $opts['recipes'] ?: implode(',', Config::$travisRecipes);
     (new BuildRecipe('base'))->tag('roboci_base')->run();
     $res = (new DockerRun('base'))->option('-i')->option('--privileged')->exec('/usr/bin/chef-solo -j /travis.json -o ' . $recipes)->run();
     $this->taskDeleteDir(Config::$buildDir)->run();
     $data = $res->getData();
     $this->yell("Container built in successfully. Run `docker commit {$data['cid']} yourname/imagename` to save it");
 }
开发者ID:beejhuff,项目名称:RoboCI,代码行数:14,代码来源:Build.php

示例3: stopOnFail

 protected function stopOnFail($stopOnFail = true)
 {
     Result::$stopOnFail = $stopOnFail;
 }
开发者ID:surjit,项目名称:PHP-Robo-Task-Runner,代码行数:4,代码来源:Tasks.php


注:本文中的Robo\Result::stopOnFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。