本文整理汇总了PHP中Cli::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Cli::run方法的具体用法?PHP Cli::run怎么用?PHP Cli::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cli
的用法示例。
在下文中一共展示了Cli::run方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testException
/**
* @expectedException RuntimeException
*/
public function testException()
{
$cli = new Cli();
$cli->setTempDir(sys_get_temp_dir());
$cli->setLogger($this->getMockBuilder('Monolog\\Logger')->disableOriginalConstructor()->getMock());
$code = Code::fromString('throw new \\Exception("test");');
$result = $cli->run($code);
}
示例2: testRun
/**
* @return void
* @covers \pFlow\Cli<extended>
* @group pflow
* @group unittest
*/
public function testRun()
{
$_SERVER['argv'] = array('pflow', '--recursive', 'some_path');
$analyzerMock = $this->getMock('\\pFlow\\AnalyzerInterface');
$analyzerMock->expects($this->once())->method('setSources')->with($this->equalTo(array('some_path')), $this->isTrue());
$cli = new Cli($analyzerMock, new \ezcConsoleInput());
$cli->run();
}
示例3: Cli
#!/usr/bin/env php
<?php
/**
*
* @package phpBB Translation Validator
* @copyright (c) 2014 phpBB Ltd.
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace Phpbb\TranslationValidator;
require 'vendor/autoload.php';
$app = new Cli();
$app->run();
示例4: Suites
//
$cc = new Colors\Color();
if (count($testClasses) == 0) {
echo $cc("WARNING ")->red()->bold();
echo $cc(" No classes have been named to be test Suites (Test????) - ")->reset();
echo $cc(" is this correct !!")->white()->bold();
echo "\n";
} else {
foreach ($runner->get_test_cases() as $obj) {
$arr = $obj->get_tests();
if (count($arr) == 0) {
echo $cc("WARNING")->red()->bold();
echo $cc(" class ")->reset();
echo $cc(get_class($obj))->cyan()->bold();
echo $cc(" has no tests method (test_???) - ")->reset();
echo $cc(" is this correct ")->white()->bold();
echo "\n ";
}
}
}
$runner->print_results();
}
}
$cli = new Cli();
$cli->addOption()->shortName('c')->longname(LiteTestCommand::CONFIG_FILE)->key(LiteTestCommand::CONFIG_FILE)->valueRequired(true)->setIsFile()->description("json config file");
$cli->addOption()->shortName('b')->longname(LiteTestCommand::BOOTSTRAP_FILE)->key(LiteTestCommand::BOOTSTRAP_FILE)->valueRequired(true)->setIsFile()->description("php bootstrap file");
$cli->addOption()->shortName("v")->key('verbose')->valueRequired(false)->description("verbose")->valueRequired(false);
$cli->addOption()->shortName("d")->key('debug')->valueRequired(false)->description("debug")->valueRequired(false);
$cli->command(new LiteTestCommand())->name("LiteTest")->description("Run php test cases using LiteTest framework")->usage("[options] [arguments]")->help("Runs php test cases with LiteTest framework");
$cli->run($argv);