[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/symfony/console/Tester/ -> ApplicationTester.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <[email protected]>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\Console\Tester;
  13  
  14  use Symfony\Component\Console\Application;
  15  use Symfony\Component\Console\Input\ArrayInput;
  16  
  17  /**
  18   * Eases the testing of console applications.
  19   *
  20   * When testing an application, don't forget to disable the auto exit flag:
  21   *
  22   *     $application = new Application();
  23   *     $application->setAutoExit(false);
  24   *
  25   * @author Fabien Potencier <[email protected]>
  26   */
  27  class ApplicationTester
  28  {
  29      use TesterTrait;
  30  
  31      private $application;
  32  
  33      public function __construct(Application $application)
  34      {
  35          $this->application = $application;
  36      }
  37  
  38      /**
  39       * Executes the application.
  40       *
  41       * Available options:
  42       *
  43       *  * interactive:               Sets the input interactive flag
  44       *  * decorated:                 Sets the output decorated flag
  45       *  * verbosity:                 Sets the output verbosity flag
  46       *  * capture_stderr_separately: Make output of stdOut and stdErr separately available
  47       *
  48       * @return int The command exit code
  49       */
  50      public function run(array $input, array $options = [])
  51      {
  52          $this->input = new ArrayInput($input);
  53          if (isset($options['interactive'])) {
  54              $this->input->setInteractive($options['interactive']);
  55          }
  56  
  57          if ($this->inputs) {
  58              $this->input->setStream(self::createStream($this->inputs));
  59          }
  60  
  61          $this->initOutput($options);
  62  
  63          return $this->statusCode = $this->application->run($this->input, $this->output);
  64      }
  65  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer