/** * @covers ::from * @dataProvider provideEverythingElse */ public function testReturnsNewEmptyEventStreamWhenGivenAnythingElse($stream) { // ---------------------------------------------------------------- // setup your test $expectedResult = new EventStream(); // ---------------------------------------------------------------- // perform the change $actualResult = GuaranteeEventStream::from($stream); // ---------------------------------------------------------------- // test the results $this->assertEquals($expectedResult, $actualResult); }
/** * run a CLI command using the popen() interface * * @param array|Traversable $command * the command to execute * @param int|null $timeout * how long before we force the command to close? * @param string|null $cwd * the folder to run the command inside * @param EventStream $eventStream * helper to send events to * @return ProcessResult * the result of executing the command */ public static function run($command, $timeout = null, $cwd = null, EventStream $eventStream = null) { // robustness RequireTraversable::checkMixed($command, E4xx_UnsupportedType::class); RequireTimeoutOrNull::check($timeout); RequireAbsoluteFolderOrNull::check($cwd); $eventStream = GuaranteeEventStream::from($eventStream); return self::runCommand($command, $timeout, $cwd, $eventStream); }