Handler example

EOT
            );

  }

  /** * {@inheritdoc} */
  protected function execute(InputInterface $input, OutputInterface $output): int {
    $handler = new Handler($this->getComposer()$this->getIO());
    $handler->scaffold();
    return 0;
  }

}
use PHPUnit\Framework\TestCase;
use Symfony\Component\Clock\ClockInterface;
use Symfony\Component\Clock\MockClock;
use Symfony\Component\Scheduler\RecurringMessage;
use Symfony\Component\Scheduler\Schedule;
use Symfony\Component\Scheduler\Scheduler;

class SchedulerTest extends TestCase
{
    public function testCanRunAndStop()
    {
        $handler = new Handler();
        $handler->clock = $clock = new MockClock();
        $schedule = (new Schedule())->add(RecurringMessage::every('1 second', new Message()));
        $scheduler = new Scheduler([Message::class => $handler][$schedule]$clock);
        $handler->scheduler = $scheduler;

        $scheduler->run(['sleep' => 100]);

        $this->assertSame(3, $handler->count);
    }
}


  public function runScaffold($cwd) {
    chdir($cwd);
    $handler = new Handler($this->getComposer()$this->io());
    $handler->scaffold();
    return $this->getOutput();
  }

  /** * Runs a `composer` command. * * @param string $cmd * The Composer command to execute (escaped as required) * @param string $cwd * The current working directory to run the command from. * * @return string * Standard output and standard error from the command. */


  /** * Instantiates the handler object upon demand. * * It is dangerous to update a Composer plugin if it loads any classes prior * to the `composer update` operation, and later tries to use them in a * post-update hook. */
  protected function handler() {
    if (!$this->handler) {
      $this->handler = new Handler($this->composer, $this->io);
      // On instantiation of our handler, notify it if the 'require' command       // was executed.       if ($this->requireWasCalled) {
        $this->handler->requireWasCalled();
      }
    }
    return $this->handler;
  }

}
Home | Imprint | This part of the site doesn't use cookies.