• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Configuration\GrumPHP类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中GrumPHP\Configuration\GrumPHP的典型用法代码示例。如果您正苦于以下问题:PHP GrumPHP类的具体用法?PHP GrumPHP怎么用?PHP GrumPHP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: ProcessArgumentsCollection

 function it_should_be_possible_to_configure_the_process_timeout(GrumPHP $config, ExternalCommand $externalCommandLocator)
 {
     $config->getProcessTimeout()->willReturn(120);
     $arguments = new ProcessArgumentsCollection(array('/usr/bin/grumphp'));
     $process = $this->buildProcess($arguments);
     $process->getTimeout()->shouldBe(120.0);
 }
开发者ID:Big-Shark,项目名称:grumphp,代码行数:7,代码来源:ProcessBuilderSpec.php


示例2: execute

 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return int|void
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $gitHooksPath = $this->paths()->getGitHooksDir();
     $resourceHooksPath = $this->paths()->getGitHookTemplatesDir() . $this->grumPHP->getHooksPreset();
     $resourceHooksPath = $this->paths()->getPathWithTrailingSlash($resourceHooksPath);
     $customHooksPath = $this->paths()->getPathWithTrailingSlash($this->grumPHP->getHooksDir());
     // Some git clients do not automatically create a git hooks folder.
     if (!$this->filesystem->exists($gitHooksPath)) {
         $this->filesystem->mkdir($gitHooksPath);
         $output->writeln(sprintf('<fg=yellow>Created git hooks folder at: %s</fg=yellow>', $gitHooksPath));
     }
     foreach (self::$hooks as $hook) {
         $gitHook = $gitHooksPath . $hook;
         $hookTemplate = new SplFileInfo($resourceHooksPath . $hook);
         if ($customHooksPath && $this->filesystem->exists($customHooksPath . $hook)) {
             $hookTemplate = new SplFileInfo($customHooksPath . $hook);
         }
         if (!$this->filesystem->exists($hookTemplate)) {
             throw new RuntimeException(sprintf('Could not find hook template for %s at %s.', $hook, $hookTemplate));
         }
         $content = $this->parseHookBody($hook, $hookTemplate);
         $this->filesystem->dumpFile($gitHook, $content);
         $this->filesystem->chmod($gitHook, 0775);
     }
     $output->writeln('<fg=yellow>Watch out! GrumPHP is sniffing your commits!<fg=yellow>');
 }
开发者ID:phpro,项目名称:grumphp,代码行数:33,代码来源:InitCommand.php


示例3: RunnerEvent

 function it_should_not_run_when_disabled(GrumPHP $grumPHP, Repository $repository)
 {
     $event = new RunnerEvent(new TasksCollection(), new GitPreCommitContext(new FilesCollection()), new TaskResultCollection());
     $grumPHP->ignoreUnstagedChanges()->willReturn(false);
     $this->saveStash($event);
     $this->popStash($event);
     $repository->run(Argument::cetera())->shouldNotBeCalled();
 }
开发者ID:phpro,项目名称:grumphp,代码行数:8,代码来源:StashUnstagedChangesSubscriberSpec.php


示例4:

 function it_runs_with_additional_modifiers(GrumPHP $grumPHP, GitCommitMsgContext $context)
 {
     $grumPHP->getTaskConfiguration('git_commit_message')->willReturn(['matchers' => ['/.*ümlaut/'], 'additional_modifiers' => 'u']);
     $context->getCommitMessage()->willReturn('message containing ümlaut');
     $result = $this->run($context);
     $result->shouldBeAnInstanceOf(TaskResultInterface::class);
     $result->isPassed()->shouldBe(true);
 }
开发者ID:phpro,项目名称:grumphp,代码行数:8,代码来源:CommitMessageSpec.php


示例5: buildProcess

 /**
  * @param ProcessArgumentsCollection $arguments
  *
  * @return Process
  * @throws \GrumPHP\Exception\PlatformException
  */
 public function buildProcess(ProcessArgumentsCollection $arguments)
 {
     $builder = SymfonyProcessBuilder::create($arguments->getValues());
     $builder->setTimeout($this->config->getProcessTimeout());
     $process = $builder->getProcess();
     $this->logProcessInVerboseMode($process);
     $this->guardWindowsCmdMaxInputStringLimitation($process);
     return $process;
 }
开发者ID:phpro,项目名称:grumphp,代码行数:15,代码来源:ProcessBuilder.php


示例6: dirname

 function it_runs_the_suite_but_not_reaching_coverage(GrumPHP $grumPHP, GitCommitMsgContext $context)
 {
     $filename = dirname(dirname(dirname(__DIR__))) . '/test/fixtures/clover_coverage/60-percent-coverage.xml';
     $grumPHP->getTaskConfiguration('clover_coverage')->willReturn(['clover_file' => $filename, 'level' => 100]);
     $result = $this->run($context);
     $result->shouldBeAnInstanceOf(TaskResultInterface::class);
     $result->getResultCode()->shouldBe(TaskResult::FAILED);
     $result->getMessage()->shouldBe('Code coverage is 60%, which is below the accepted 100%' . PHP_EOL);
 }
开发者ID:phpro,项目名称:grumphp,代码行数:9,代码来源:CloverCoverageSpec.php


示例7: sortByPriority

 /**
  * This method sorts the tasks by highest priority first.
  *
  * @param GrumPHP $grumPHP
  *
  * @return TasksCollection
  */
 public function sortByPriority(GrumPHP $grumPHP)
 {
     $priorityQueue = new SplPriorityQueue();
     $stableSortIndex = PHP_INT_MAX;
     foreach ($this->getIterator() as $task) {
         $metadata = $grumPHP->getTaskMetadata($task->getName());
         $priorityQueue->insert($task, array($metadata['priority'], $stableSortIndex--));
     }
     return new TasksCollection(array_values(iterator_to_array($priorityQueue)));
 }
开发者ID:eltonoliveira,项目名称:grumphp,代码行数:17,代码来源:TasksCollection.php


示例8: ProcessArgumentsCollection

 function it_runs_the_suite_when_composer_has_changed_and_run_always_is_false(GrumPHP $grumPHP, ProcessBuilder $processBuilder, Process $process, ContextInterface $context)
 {
     $grumPHP->getTaskConfiguration('securitychecker')->willReturn(array('run_always' => false));
     $arguments = new ProcessArgumentsCollection();
     $processBuilder->createArgumentsForCommand('security-checker')->willReturn($arguments);
     $processBuilder->buildProcess($arguments)->willReturn($process);
     $process->run()->shouldBeCalled();
     $process->isSuccessful()->willReturn(true);
     $context->getFiles()->willReturn(new FilesCollection(array(new SplFileInfo('composer.lock', '.', 'composer.lock'))));
     $this->run($context);
 }
开发者ID:eltonoliveira,项目名称:grumphp,代码行数:11,代码来源:SecurityCheckerSpec.php


示例9: array

 function it_throws_exception_if_the_process_is_successfull(GrumPHP $grumPHP, ProcessBuilder $processBuilder, Process $process, ContextInterface $context)
 {
     $grumPHP->getTaskConfiguration('git_blacklist')->willReturn(array('keywords' => array('var_dump(')));
     $arguments = new ProcessArgumentsCollection();
     $processBuilder->createArgumentsForCommand('git')->willReturn($arguments);
     $processBuilder->buildProcess($arguments)->willReturn($process);
     $process->run()->shouldBeCalled();
     $process->isSuccessful()->willReturn(true);
     $process->getOutput()->shouldBeCalled();
     $context->getFiles()->willReturn(new FilesCollection(array(new SplFileInfo('file1.php', '.', 'file1.php'))));
     $this->shouldThrow('GrumPHP\\Exception\\RuntimeException')->duringRun($context);
 }
开发者ID:alexlondon07,项目名称:grumphp,代码行数:12,代码来源:BlacklistSpec.php


示例10: ProcessArgumentsCollection

 function it_runs_if_there_are_no_files_but_always_execute_is_passed(GrumPHP $grumPHP, Process $process, ProcessBuilder $processBuilder, ContextInterface $context)
 {
     $grumPHP->getTaskConfiguration('phpunit')->willReturn(['always_execute' => true]);
     $arguments = new ProcessArgumentsCollection();
     $processBuilder->createArgumentsForCommand('phpunit')->willReturn($arguments);
     $processBuilder->buildProcess($arguments)->willReturn($process);
     $process->run()->shouldBeCalled();
     $process->isSuccessful()->willReturn(true);
     $context->getFiles()->willReturn(new FilesCollection());
     $result = $this->run($context);
     $result->shouldBeAnInstanceOf(TaskResultInterface::class);
     $result->isPassed()->shouldBe(true);
 }
开发者ID:phpro,项目名称:grumphp,代码行数:13,代码来源:PhpunitSpec.php


示例11: ProcessArgumentsCollection

 function it_throws_exception_if_the_process_is_successfull(GrumPHP $grumPHP, ProcessBuilder $processBuilder, Process $process, ContextInterface $context)
 {
     $grumPHP->getTaskConfiguration('git_blacklist')->willReturn(['keywords' => ['var_dump(']]);
     $arguments = new ProcessArgumentsCollection();
     $processBuilder->createArgumentsForCommand('git')->willReturn($arguments);
     $processBuilder->buildProcess($arguments)->willReturn($process);
     $process->run()->shouldBeCalled();
     $process->isSuccessful()->willReturn(true);
     $context->getFiles()->willReturn(new FilesCollection([new SplFileInfo('file1.php', '.', 'file1.php')]));
     $result = $this->run($context);
     $result->shouldBeAnInstanceOf(TaskResultInterface::class);
     $result->isPassed()->shouldBe(false);
 }
开发者ID:phpro,项目名称:grumphp,代码行数:13,代码来源:BlacklistSpec.php


示例12: FilesCollection

 function it_runs_the_suite_for_all_files(GrumPHP $grumPHP, ProcessBuilder $processBuilder, Process $process, RunContext $context, PhpCsFixerFormatter $formatter)
 {
     $grumPHP->getTaskConfiguration('phpcsfixer')->willReturn(array('config_file' => '.php_cs'));
     $formatter->resetCounter()->shouldBeCalled();
     $context->getFiles()->willReturn(new FilesCollection(array($file1 = new SplFileInfo('file1.php', '.', 'file1.php'), $file2 = new SplFileInfo('file2.php', '.', 'file2.php'))));
     $processBuilder->createArgumentsForCommand('php-cs-fixer')->willReturn(new ProcessArgumentsCollection());
     $processBuilder->buildProcess(Argument::that(function (ProcessArgumentsCollection $args) use($file1, $file2) {
         return !($args->contains($file1) || $args->contains($file2));
     }))->willReturn($process);
     $process->run()->shouldBeCalled();
     $process->isSuccessful()->willReturn(true);
     $result = $this->run($context);
     $result->shouldBeAnInstanceOf('GrumPHP\\Runner\\TaskResultInterface');
     $result->isPassed()->shouldBe(true);
 }
开发者ID:Big-Shark,项目名称:grumphp,代码行数:15,代码来源:PhpCsFixerSpec.php


示例13:

 function it_should_sort_on_priority(TaskInterface $task1, TaskInterface $task2, TaskInterface $task3, GrumPHP $grumPHP)
 {
     $this->beConstructedWith(array($task1, $task2, $task3));
     $task1->getName()->willReturn('task1');
     $task2->getName()->willReturn('task2');
     $task3->getName()->willReturn('task3');
     $grumPHP->getTaskMetadata('task1')->willReturn(array('priority' => 100));
     $grumPHP->getTaskMetadata('task2')->willReturn(array('priority' => 200));
     $grumPHP->getTaskMetadata('task3')->willReturn(array('priority' => 100));
     $result = $this->sortByPriority($grumPHP);
     $result->shouldBeAnInstanceOf('GrumPHP\\Collection\\TasksCollection');
     $result->count()->shouldBe(3);
     $tasks = $result->toArray();
     $tasks[0]->shouldBe($task2);
     $tasks[1]->shouldBe($task1);
     $tasks[2]->shouldBe($task3);
 }
开发者ID:eltonoliveira,项目名称:grumphp,代码行数:17,代码来源:TasksCollectionSpec.php


示例14: let

 function let(GrumPHP $grumPHP, ProcessBuilder $processBuilder, ProcessFormatterInterface $formatter)
 {
     $grumPHP->getTaskConfiguration('composer_script')->willReturn(['script' => 'test']);
     $this->beConstructedWith($grumPHP, $processBuilder, $formatter);
 }
开发者ID:phpro,项目名称:grumphp,代码行数:5,代码来源:ComposerScriptSpec.php


示例15: let

 function let(GrumPHP $grumPHP, YamlLinter $linter)
 {
     $grumPHP->getTaskConfiguration('yamllint')->willReturn([]);
     $this->beConstructedWith($grumPHP, $linter);
 }
开发者ID:phpro,项目名称:grumphp,代码行数:5,代码来源:YamlLintSpec.php


示例16: let

 function let(GrumPHP $grumPHP, ProcessBuilder $processBuilder, ProcessFormatterInterface $formatter)
 {
     $grumPHP->getTaskConfiguration('shell')->willReturn(['scripts' => ['script.sh']]);
     $this->beConstructedWith($grumPHP, $processBuilder, $formatter);
 }
开发者ID:phpro,项目名称:grumphp,代码行数:5,代码来源:ShellSpec.php


示例17: getAvailableTasks

 /**
  * Return a list of all available tasks
  *
  * @return array
  */
 protected function getAvailableTasks(GrumPHP $config)
 {
     return $config->getRegisteredTasks();
 }
开发者ID:Big-Shark,项目名称:grumphp,代码行数:9,代码来源:ConfigureCommand.php


示例18: let

 function let(GrumPHP $grumPHP, JsonLinter $linter)
 {
     $grumPHP->getTaskConfiguration('jsonlint')->willReturn(array());
     $this->beConstructedWith($grumPHP, $linter);
 }
开发者ID:Big-Shark,项目名称:grumphp,代码行数:5,代码来源:JsonLintSpec.php


示例19: let

 function let(GrumPHP $grumPHP, ProcessBuilder $processBuilder)
 {
     $grumPHP->getTaskConfiguration('behat')->willReturn(array());
     $this->beConstructedWith($grumPHP, $processBuilder);
 }
开发者ID:aaa2000,项目名称:grumphp,代码行数:5,代码来源:BehatSpec.php


示例20: let

 function let(GrumPHP $grumPHP, ProcessBuilder $processBuilder, ProcessFormatterInterface $formatter)
 {
     $grumPHP->getTaskConfiguration('phing')->willReturn([]);
     $this->beConstructedWith($grumPHP, $processBuilder, $formatter);
 }
开发者ID:phpro,项目名称:grumphp,代码行数:5,代码来源:PhingSpec.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Context\ContextInterface类代码示例发布时间:2022-05-23
下一篇:
PHP Pokemath\PokeNumber类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap