本文整理匯總了PHP中Symfony\Component\Console\Input\InputInterface::expects方法的典型用法代碼示例。如果您正苦於以下問題:PHP InputInterface::expects方法的具體用法?PHP InputInterface::expects怎麽用?PHP InputInterface::expects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Console\Input\InputInterface
的用法示例。
在下文中一共展示了InputInterface::expects方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ConfigurationHelper
public function testConfigurationHelperWithoutConfigurationFromSetterAndWithoutOverrideFromCommandLineAndWithoutConfigInPath()
{
$this->input->expects($this->any())->method('getOption')->with('configuration')->will($this->returnValue(null));
$configurationHelper = new ConfigurationHelper($this->connection, null);
$migrationConfig = $configurationHelper->getMigrationConfig($this->input, $this->getOutputWriter());
$this->assertInstanceOf('Doctrine\\DBAL\\Migrations\\Configuration\\Configuration', $migrationConfig);
$this->assertStringMatchesFormat("", $this->getOutputStreamContent($this->output));
}
示例2: prepareOptions
protected function prepareOptions($publish = '', $config = '')
{
$this->inputMock->expects($this->any())->method('getOption')->will($this->returnCallback(function ($arg) use($publish, $config) {
switch ($arg) {
case 'publishPath':
return $publish;
case 'configPath':
return $config;
}
}));
}
示例3: setupEnvironment
/**
* @param string $cwd Current working directory
* @param string $inputGet User specified path
* @param bool $inputHas
*/
protected function setupEnvironment($cwd, $inputGet, $inputHas = true)
{
$getcwd = $this->getFunctionMock('\\Phlib\\ConsoleConfiguration\\Helper', 'getcwd');
$getcwd->expects($this->any())->will($this->returnValue($cwd));
$this->input->expects($this->any())->method('hasOption')->will($this->returnValue($inputHas));
$this->input->expects($this->any())->method('getOption')->will($this->returnValue($inputGet));
}
示例4: setUp
/**
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
*
*/
protected function setUp()
{
parent::setUp();
$this->prepareFolder();
$this->inputMock = $this->getMock(InputInterface::class);
$this->inputMock->expects($this->any())->method('isInteractive')->will($this->returnValue(true));
$this->outputMock = $this->getMock(OutputInterface::class);
$this->publisherScanner = new PublisherScanner();
$this->publisherScanner->registerTypeHandler('php', \Dubpub\Publisher\Handlers\PHPHandler::class);
$this->publisherScanner->registerTypeHandler('json', \Dubpub\Publisher\Handlers\JSONHandler::class);
$this->publisherScanner->registerTypeHandler('ini', \Dubpub\Publisher\Handlers\INIHandler::class);
$yamlHandler = new \Dubpub\Publisher\Handlers\YAMLHandler(new \Symfony\Component\Yaml\Parser(), new \Symfony\Component\Yaml\Dumper());
$this->publisherScanner->registerTypeHandler('yml', $yamlHandler);
$this->publisherScanner->registerTypeHandler('yaml', $yamlHandler);
$this->testInstance = $this->getCommand($this->publisherScanner);
}
示例5: testQuietness
/**
* Test quietness
*
* @dataProvider dataQuietness
*/
public function testQuietness($quiet, $noInteraction, $confirmation, $countWriteln, $countDescriber, $countClient, $countExecute)
{
$this->input->expects($this->any())->method('getOption')->will($this->returnValueMap(array(array('quiet', $quiet), array('no-interaction', $noInteraction))));
$this->questionHelper->expects($this->any())->method('ask')->will($this->returnValue($confirmation));
$this->output->expects($countWriteln)->method('writeln');
$this->gearmanDescriber->expects($countDescriber)->method('describeJob')->will($this->returnValue('olakase'));
$this->gearmanClient->expects($countClient)->method('getJob')->will($this->returnValue(array()));
$this->gearmanExecute->expects($countExecute)->method('executeJob');
$this->command->setGearmanClient($this->gearmanClient)->setGearmanDescriber($this->gearmanDescriber)->setGearmanExecute($this->gearmanExecute)->setKernel($this->kernel)->run($this->input, $this->output);
}
示例6: prepareInput
protected function prepareInput($badInput = false)
{
$this->inputMock->expects($this->any())->method('getArgument')->will($this->returnCallback(function () {
switch ($agr = func_get_arg(0)) {
case 'package':
case 'group':
return '*';
default:
var_dump($agr) || die;
}
}));
$this->inputMock->expects($this->any())->method('getOption')->will($this->returnCallback(function () use($badInput) {
switch ($agr = func_get_arg(0)) {
case 'configPath':
case 'publishPath':
return $badInput ? uniqid() : getcwd();
default:
var_dump($agr) || die;
}
}));
}
示例7: testQuietness
/**
* Test quietness
*
* @dataProvider dataQuietness
*/
public function testQuietness($quiet, $countWriteln)
{
$this->input->expects($this->any())->method('getOption')->will($this->returnValueMap(array(array('quiet', $quiet))));
$this->output->expects($countWriteln)->method('writeln');
$this->command->setGearmanClient($this->gearmanClient)->setKernel($this->kernel)->run($this->input, $this->output);
}
示例8: testRunNonQuiet
/**
* Test run without quietness
*/
public function testRunNonQuiet()
{
$this->input->expects($this->any())->method('getOption')->will($this->returnValueMap(array(array('quiet', false))));
$this->output->expects($this->any())->method('writeln');
$this->command->run($this->input, $this->output);
}