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


PHP DialogHelper::setInputStream方法代码示例

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


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

示例1: iExecuteCommandAndConfirm

 /**
  * @param string $name
  */
 private function iExecuteCommandAndConfirm($name)
 {
     $this->dialog = $this->command->getHelper('dialog');
     $inputString = 'y' . PHP_EOL;
     $this->dialog->setInputStream($this->getInputStream($inputString));
     $this->tester->execute(['command' => $name]);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:10,代码来源:InstallerContext.php

示例2: testRun

 public function testRun()
 {
     $app = $this->getApp();
     $command = new LogClear($app);
     $dialog = new DialogHelper();
     $dialog->setInputStream($this->getInputStream("Yes\n"));
     $command->setHelperSet(new HelperSet(array($dialog)));
     $tester = new CommandTester($command);
     $tester->execute(array());
     $result = $tester->getDisplay();
     $this->assertRegexp('/System & change logs cleared/', $result);
 }
开发者ID:aaleksu,项目名称:bolt_cm,代码行数:12,代码来源:LogClearTest.php

示例3: testUninstallDoesNotUninstallIfConfirmationDenied

 /**
  * Check that Magento is not removed if confirmation is denied
  */
 public function testUninstallDoesNotUninstallIfConfirmationDenied()
 {
     $application = $this->getApplication();
     $application->add(new UninstallCommand());
     $command = $this->getApplication()->find('uninstall');
     $commandTester = new CommandTester($command);
     $dialog = new DialogHelper();
     $dialog->setInputStream($this->getInputStream('no\\n'));
     $command->setHelperSet(new HelperSet(array($dialog)));
     $commandTester->execute(array('command' => $command->getName(), '--installationFolder' => $this->getTestMagentoRoot()));
     $this->assertEquals("Really uninstall ? [n]: ", $commandTester->getDisplay());
     //check magento still installed
     $this->assertFileExists($this->getTestMagentoRoot() . '/app/etc/local.xml');
 }
开发者ID:antistatique,项目名称:n98-magerun,代码行数:17,代码来源:UninstallCommandTest.php

示例4: testAskAndValidate

 public function testAskAndValidate()
 {
     $dialog = new DialogHelper();
     $helperSet = new HelperSet(array(new FormatterHelper()));
     $dialog->setHelperSet($helperSet);
     $question = 'What color was the white horse of Henry IV?';
     $error = 'This is not a color!';
     $validator = function ($color) use($error) {
         if (!in_array($color, array('white', 'black'))) {
             throw new \InvalidArgumentException($error);
         }
         return $color;
     };
     $dialog->setInputStream($this->getInputStream("\nblack\n"));
     $this->assertEquals('white', $dialog->askAndValidate($this->getOutputStream(), $question, $validator, 2, 'white'));
     $this->assertEquals('black', $dialog->askAndValidate($this->getOutputStream(), $question, $validator, 2, 'white'));
     $dialog->setInputStream($this->getInputStream("green\nyellow\norange\n"));
     try {
         $this->assertEquals('white', $dialog->askAndValidate($this->getOutputStream(), $question, $validator, 2, 'white'));
         $this->fail();
     } catch (\InvalidArgumentException $e) {
         $this->assertEquals($error, $e->getMessage());
     }
 }
开发者ID:laiello,项目名称:masfletes,代码行数:24,代码来源:DialogHelperTest.php

示例5: testInteractiveCommand

 public function testInteractiveCommand()
 {
     $command = $this->console->find('new');
     // prepare the data that will be input interactively
     // code copied from Sensio\Bundle\GeneratorBundle\Tests\Command\GenerateCommandTest.php
     $dialog = new DialogHelper();
     $dialog->setInputStream($this->getInputStream("\n\nThe Origin of Species\n"));
     $helper = new HelperSet(array(new FormatterHelper(), $dialog));
     $command->setHelperSet($helper);
     $tester = new CommandTester($command);
     $tester->execute(array('command' => $command->getName(), '--dir' => $this->tmpDir), array('interactive' => true));
     $this->assertContains('ERROR: The title cannot be empty.', $tester->getDisplay(), 'The interactive generator validates wrong title input');
     $this->assertContains('Welcome to the easybook interactive book generator', $tester->getDisplay(), 'The interactive generator welcome message is shown');
     $this->assertContains('Please, type the title of the book (e.g. The Origin of Species)', $tester->getDisplay(), 'The interactive generator asks for the title of the book');
     $this->assertContains('OK  You can start writing your book in the following directory', $tester->getDisplay(), 'Interactive book generation is successfully completed');
     $this->assertContains('the-origin-of-species', $tester->getDisplay(), 'The book is generated in the proper directory');
 }
开发者ID:raulfraile,项目名称:easybook,代码行数:17,代码来源:BookNewCommandTest.php

示例6: testInteractiveCommand

 public function testInteractiveCommand()
 {
     $command = $this->console->find('customize');
     // prepare the data that will be input interactively
     // code copied from Sensio\Bundle\GeneratorBundle\Tests\Command\GenerateCommandTest.php
     $dialog = new DialogHelper();
     $dialog->setInputStream($this->getInputStream("\n\nthe-origin-of-species\n\n\nweb\n"));
     $helper = new HelperSet(array(new FormatterHelper(), $dialog));
     $command->setHelperSet($helper);
     $tester = new CommandTester($command);
     $tester->execute(array('command' => $command->getName(), '--dir' => $this->tmpDir), array('interactive' => true));
     $app = $command->getApp();
     $this->assertContains($app['app.signature'], $tester->getDisplay(), 'The interactive customizer displays the application signature');
     $this->assertContains('Welcome to the easybook interactive book customizer', $tester->getDisplay(), 'The interactive customizer welcome message is shown');
     $this->assertContains('Please, type the slug of the book (e.g. the-origin-of-species)', $tester->getDisplay(), 'The interactive generator asks for the title of the book');
     $this->assertContains('ERROR: The slug can only contain letters, numbers and dashes (no spaces)', $tester->getDisplay(), 'Interactive publisher validates wrong "slug" input');
     $this->assertContains('OK  You can now customize the book design with the following stylesheet:', $tester->getDisplay(), 'The custom CSS is successfully generated');
 }
开发者ID:oiat,项目名称:e-book-creator,代码行数:18,代码来源:BookCustomizeCommandTest.php

示例7: testInteractiveCommand

 public function testInteractiveCommand()
 {
     $command = $this->console->find('publish');
     // prepare the data that will be input interactively
     // code copied from Sensio\Bundle\GeneratorBundle\Tests\Command\GenerateCommandTest.php
     $dialog = new DialogHelper();
     $dialog->setInputStream($this->getInputStream("\n\nthe-origin-of-species\n\n\nweb\n"));
     $helper = new HelperSet(array(new FormatterHelper(), $dialog));
     $command->setHelperSet($helper);
     $tester = new CommandTester($command);
     $tester->execute(array('command' => $command->getName(), '--dir' => $this->tmpDir), array('interactive' => true));
     $this->assertContains('Welcome to the easybook interactive book publisher', $tester->getDisplay(), 'The interactive publisher welcome message is shown');
     $this->assertContains('Please, type the slug of the book (e.g. the-origin-of-species)', $tester->getDisplay(), 'The interactive generator asks for the title of the book');
     $this->assertContains('ERROR: The slug can only contain letters, numbers and dashes (no spaces)', $tester->getDisplay(), 'Interactive publisher validates wrong "slug" input');
     $this->assertContains('ERROR: The edition cannot be empty.', $tester->getDisplay(), 'Interactive publisher validates wrong "edition" input');
     $this->assertContains('Publishing web edition of The Origin of Species book...', $tester->getDisplay(), 'The book is being published');
     $this->assertContains('OK  You can access the book in the following directory:', $tester->getDisplay(), 'The book is successfully published');
     $this->assertContains('/the-origin-of-species/Output/web', $tester->getDisplay(), 'The book is published in the proper directory');
 }
开发者ID:raulfraile,项目名称:easybook,代码行数:19,代码来源:BookPublishCommandTest.php


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