Lines Matching refs:this

58             $this->markTestSkipped('False-positive on Windows/appveyor.');
72 $this->markTestSkipped('This test is transient on Windows');
75 $process = $this->getProcessForCode('sleep(3)');
78 $this->assertEquals('Test Error', $actualError['message']);
79 $this->assertEquals(\E_USER_NOTICE, $actualError['type']);
84 $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
85 $this->getProcess('', null, null, null, -1);
90 $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
91 $p = $this->getProcess('');
97 $p = $this->getProcess('');
100 $this->assertSame(10.0, $p->getTimeout());
103 $this->assertNull($p->getTimeout());
106 $this->assertNull($p->getTimeout());
114 $p = $this->getProcess([self::$phpBin, __DIR__.'/NonStopableProcess.php', 30]);
125 $this->assertLessThan(15, microtime(true) - $start);
140 $p = $this->getProcessForCode($code);
157 $this->assertEquals($expectedOutputSize, \strlen($o));
162 $process = $this->getProcess('echo foo');
169 $this->assertSame('foo'.\PHP_EOL, $data);
179 $p = $this->getProcessForCode($code);
182 $this->assertSame($expected, $p->$getter());
195 $p = $this->getProcessForCode($code);
199 $this->assertEquals($expectedLength, \strlen($p->getOutput()));
200 $this->assertEquals($expectedLength, \strlen($p->getErrorOutput()));
215 $p = $this->getProcessForCode($code);
221 $this->assertEquals($expectedLength, \strlen($p->getOutput()));
222 $this->assertEquals($expectedLength, \strlen($p->getErrorOutput()));
231 $p = $this->getProcessForCode('stream_copy_to_stream(STDIN, STDOUT);');
240 $this->assertSame('hello', $p->getOutput());
245 $this->expectException('Symfony\Component\Process\Exception\LogicException');
246 $this->expectExceptionMessage('Input can not be set while the process is running.');
247 $process = $this->getProcessForCode('sleep(30);');
252 $this->fail('A LogicException should have been raised.');
265 $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
266 …$this->expectExceptionMessage('"Symfony\Component\Process\Process::setInput" only accepts strings,…
267 $process = $this->getProcess('foo');
284 $process = $this->getProcess('foo');
286 $this->assertSame($expected, $process->getInput());
317 $process = $this->getProcess(sprintf('echo %s %s echo %s', $input, $operator, $input));
319 $this->assertEquals($expected, $process->getOutput());
324 $p = $this->getProcessForCode('echo \'foo\';');
331 $this->assertTrue($called, 'The callback should be executed with the output');
336 $p = $this->getProcessForCode('echo \'foo\';');
344 $this->assertTrue($called, 'The callback should be executed with the output');
349 …$p = $this->getProcessForCode('$n = 0; while ($n < 3) { file_put_contents(\'php://stderr\', \'ERRO…
352 $this->assertEquals(3, preg_match_all('/ERROR/', $p->getErrorOutput(), $matches));
357 …$p = $this->getProcessForCode('$n = 0; while ($n < 3) { file_put_contents(\'php://stderr\', \'ERRO…
361 $this->assertEmpty($p->getErrorOutput());
371 …$p = $this->getProcessForCode('file_put_contents($s = \''.$uri.'\', \'foo\'); flock(fopen('.var_ex…
383 $this->assertSame($s, $p->$getIncrementalOutput());
384 $this->assertSame('', $p->$getIncrementalOutput());
402 $p = $this->getProcessForCode('$n = 0; while ($n < 3) { echo \' foo \'; $n++; }');
405 $this->assertEquals(3, preg_match_all('/foo/', $p->getOutput(), $matches));
410 $p = $this->getProcessForCode('$n=0;while ($n<3) {echo \' foo \';$n++;}');
414 $this->assertEmpty($p->getOutput());
421 $p = $this->getProcess('echo | set /p dummyName=0');
423 $p = $this->getProcess('printf 0');
427 $this->assertSame('0', $p->getOutput());
433 $this->markTestSkipped('Windows does not support POSIX exit code');
435 $this->skipIfNotEnhancedSigchild();
438 … $process = $this->getProcess('nonexistingcommandIhopeneversomeonewouldnameacommandlikethis');
441 $this->assertGreaterThan(0, $process->getExitCode());
447 $this->markTestSkipped('Windows does not have /dev/tty support');
450 …$process = $this->getProcess('echo "foo" >> /dev/null && '.$this->getProcessForCode('usleep(100000…
453 $this->assertTrue($process->isRunning());
456 $this->assertSame(Process::STATUS_TERMINATED, $process->getStatus());
462 $this->markTestSkipped('Windows does have /dev/tty support');
464 $this->skipIfNotEnhancedSigchild();
466 $process = $this->getProcess('echo "foo" >> /dev/null');
470 $this->assertTrue($process->isSuccessful());
475 $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
476 $this->expectExceptionMessage('TTY mode is not supported on Windows platform.');
478 $this->markTestSkipped('This test is for Windows platform only');
481 $process = $this->getProcess('echo "foo" >> /dev/null');
488 $this->skipIfNotEnhancedSigchild();
490 $process = $this->getProcess('');
491 $this->assertNull($process->getExitCodeText());
497 $this->markTestSkipped('PTY is not supported on this operating system.');
500 $process = $this->getProcess('echo "foo"');
504 $this->assertSame(Process::STATUS_TERMINATED, $process->getStatus());
505 $this->assertEquals("foo\r\n", $process->getOutput());
510 $this->skipIfNotEnhancedSigchild();
512 $process = $this->getProcess('echo foo');
514 $this->assertSame($process, $process->mustRun());
515 $this->assertEquals('foo'.\PHP_EOL, $process->getOutput());
520 $this->skipIfNotEnhancedSigchild();
522 $process = $this->getProcess('echo foo')->mustRun();
523 $this->assertEquals(0, $process->getExitCode());
528 $this->expectException('Symfony\Component\Process\Exception\ProcessFailedException');
529 $this->skipIfNotEnhancedSigchild();
531 $process = $this->getProcess('exit 1');
537 $this->skipIfNotEnhancedSigchild();
539 $process = $this->getProcess('');
545 $this->assertEquals('Misuse of shell builtins', $process->getExitCodeText());
550 $process = $this->getProcessForCode('usleep(500000);');
554 $this->assertLessThan(0.4, $end - $start);
560 $process = $this->getProcess('echo foo');
562 $this->assertGreaterThan(0, \strlen($process->getOutput()));
567 $this->skipIfNotEnhancedSigchild();
569 $process = $this->getProcessForCode('usleep(100000);');
570 $this->assertNull($process->getExitCode());
572 $this->assertNull($process->getExitCode());
574 $this->assertEquals(0, $process->getExitCode());
579 $this->skipIfNotEnhancedSigchild();
581 $process = $this->getProcessForCode('usleep(100000);');
583 $this->assertEquals(0, $process->getExitCode());
585 $this->assertNull($process->getExitCode());
587 $this->assertEquals(0, $process->getExitCode());
592 $this->skipIfNotEnhancedSigchild();
594 $process = $this->getProcess('echo foo');
596 $this->assertSame(0, $process->getExitCode());
601 $process = $this->getProcessForCode('usleep(100000);');
602 $this->assertFalse($process->isRunning());
603 $this->assertFalse($process->isStarted());
604 $this->assertFalse($process->isTerminated());
605 $this->assertSame(Process::STATUS_READY, $process->getStatus());
607 $this->assertTrue($process->isRunning());
608 $this->assertTrue($process->isStarted());
609 $this->assertFalse($process->isTerminated());
610 $this->assertSame(Process::STATUS_STARTED, $process->getStatus());
612 $this->assertFalse($process->isRunning());
613 $this->assertTrue($process->isStarted());
614 $this->assertTrue($process->isTerminated());
615 $this->assertSame(Process::STATUS_TERMINATED, $process->getStatus());
620 $process = $this->getProcessForCode('sleep(31);');
622 $this->assertTrue($process->isRunning());
624 $this->assertFalse($process->isRunning());
629 $this->skipIfNotEnhancedSigchild();
631 $process = $this->getProcess('echo foo');
633 $this->assertTrue($process->isSuccessful());
638 $this->skipIfNotEnhancedSigchild();
640 $process = $this->getProcessForCode('usleep(100000);');
643 $this->assertFalse($process->isSuccessful());
647 $this->assertTrue($process->isSuccessful());
652 $this->skipIfNotEnhancedSigchild();
654 $process = $this->getProcessForCode('throw new \Exception(\'BOUM\');');
656 $this->assertFalse($process->isSuccessful());
662 $this->markTestSkipped('Windows does not support POSIX signals');
664 $this->skipIfNotEnhancedSigchild();
666 $process = $this->getProcess('echo foo');
668 $this->assertFalse($process->hasBeenSignaled());
674 $this->markTestSkipped('Windows does not support POSIX signals');
676 $this->skipIfNotEnhancedSigchild();
678 $process = $this->getProcess('echo foo');
680 $this->assertEquals(0, $process->getTermSignal());
686 $this->markTestSkipped('Windows does not support POSIX signals');
688 $this->skipIfNotEnhancedSigchild();
690 $process = $this->getProcessForCode('sleep(32);');
693 $this->assertTrue($process->hasBeenSignaled());
694 $this->assertEquals(15, $process->getTermSignal()); // SIGTERM
699 $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
700 $this->expectExceptionMessage('The process has been signaled');
702 $this->markTestSkipped('Function posix_kill is required.');
704 $this->skipIfNotEnhancedSigchild(false);
706 $process = $this->getProcessForCode('sleep(32.1);');
715 $process1 = $this->getProcessForCode('echo getmypid();');
722 $this->assertFalse($process1->isRunning());
723 $this->assertFalse($process2->isRunning());
724 $this->assertIsNumeric($process1->getOutput());
725 $this->assertIsNumeric($process2->getOutput());
728 $this->assertNotEquals($process1->getOutput(), $process2->getOutput());
733 $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException');
734 $this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.');
735 $process = $this->getProcessForCode('sleep(30);');
740 $this->fail('A RuntimeException should have been raised');
744 $this->assertLessThan(15, microtime(true) - $start);
751 $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException');
752 $this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.');
753 $process = $this->getProcessForCode('sleep(30);');
759 $this->fail('A RuntimeException should have been raised');
763 $this->assertLessThan(15, microtime(true) - $start);
770 $process = $this->getProcess('echo foo');
771 $this->assertNull($process->checkTimeout());
776 $process = $this->getProcess('echo foo');
778 $this->assertNull($process->checkTimeout());
783 $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException');
784 $this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.');
785 $process = $this->getProcessForCode('sleep(33);');
796 $this->fail('A ProcessTimedOutException should have been raised');
800 $this->assertLessThan(15, microtime(true) - $start);
807 $process = $this->getProcessForCode('sleep(34);');
814 $this->fail('A timeout exception was expected.');
816 $this->assertTrue($e->isIdleTimeout());
817 $this->assertFalse($e->isGeneralTimeout());
818 $this->assertEquals(0.1, $e->getExceededTimeout());
824 $process = $this->getProcessForCode('while (true) {echo \'foo \'; usleep(1000);}');
836 $this->fail('A timeout exception was expected.');
838 $this->assertTrue($e->isGeneralTimeout(), 'A general timeout is expected.');
839 $this->assertFalse($e->isIdleTimeout(), 'No idle timeout is expected.');
840 $this->assertEquals(1, $e->getExceededTimeout());
846 $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException');
847 $this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.');
848 $process = $this->getProcessForCode('sleep(35);');
853 $this->fail('A ProcessTimedOutException should have been raised.');
856 $this->assertFalse($process->isRunning());
858 $this->assertTrue($process->isRunning());
866 $process = $this->getProcessForCode('sleep(36);');
868 $this->assertGreaterThan(0, $process->getPid());
874 $process = $this->getProcess('foo');
875 $this->assertNull($process->getPid());
880 $process = $this->getProcess('echo foo');
882 $this->assertNull($process->getPid());
890 $process = $this->getProcess([self::$phpBin, __DIR__.'/SignalListener.php']);
899 $this->assertEquals('Caught SIGUSR1', $process->getOutput());
907 $this->skipIfNotEnhancedSigchild();
909 $process = $this->getProcess('sleep 4');
917 $this->assertFalse($process->isRunning());
918 $this->assertTrue($process->hasBeenSignaled());
919 $this->assertFalse($process->isSuccessful());
920 $this->assertEquals(137, $process->getExitCode());
925 $this->expectException('Symfony\Component\Process\Exception\LogicException');
926 $this->expectExceptionMessage('Can not send signal on a non running process.');
927 $process = $this->getProcess('foo');
936 $process = $this->getProcess('foo');
938 $this->expectException('Symfony\Component\Process\Exception\LogicException');
939 … $this->expectExceptionMessage(sprintf('Process must be started before calling "%s()".', $method));
960 $this->expectException('Symfony\Component\Process\Exception\LogicException');
961 $this->expectExceptionMessage('Process must be terminated before calling');
962 $process = $this->getProcessForCode('sleep(37);');
967 $this->fail('A LogicException must have been thrown');
991 $this->markTestSkipped('POSIX signals do not work on Windows');
995 $this->expectException(RuntimeException::class);
997 $this->expectException('TypeError');
1000 $process = $this->getProcessForCode('sleep(38);');
1004 $this->fail('A RuntimeException must have been thrown');
1024 $p = $this->getProcess('foo');
1025 $this->assertFalse($p->isOutputDisabled());
1027 $this->assertTrue($p->isOutputDisabled());
1029 $this->assertFalse($p->isOutputDisabled());
1034 $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
1035 … $this->expectExceptionMessage('Disabling output while the process is running is not possible.');
1036 $p = $this->getProcessForCode('sleep(39);');
1043 $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
1044 … $this->expectExceptionMessage('Enabling output while the process is running is not possible.');
1045 $p = $this->getProcessForCode('sleep(40);');
1053 $p = $this->getProcess('echo foo');
1058 $this->assertTrue($p->isOutputDisabled());
1063 $this->expectException('Symfony\Component\Process\Exception\LogicException');
1064 $this->expectExceptionMessage('Output can not be disabled while an idle timeout is set.');
1065 $process = $this->getProcess('foo');
1072 $this->expectException('Symfony\Component\Process\Exception\LogicException');
1073 $this->expectExceptionMessage('timeout can not be set while the output is disabled.');
1074 $process = $this->getProcess('foo');
1081 $process = $this->getProcess('foo');
1083 $this->assertSame($process, $process->setIdleTimeout(null));
1091 $this->expectException('Symfony\Component\Process\Exception\LogicException');
1092 $this->expectExceptionMessage('Output has been disabled.');
1093 $p = $this->getProcessForCode('sleep(41);');
1111 $process = $this->getProcessForCode('echo 123; sleep(42);');
1115 …$this->assertTrue(true, 'A call to stop() is not expected to cause wait() to throw a RuntimeExcept…
1120 $process = $this->getProcessForCode('echo 123; sleep(43);');
1124 …$this->assertTrue(true, 'A call to signal() is not expected to cause wait() to throw a RuntimeExce…
1129 $process = $this->getProcessForCode('echo 123; sleep(44);');
1133 …$this->assertTrue(true, 'A call to signal() is not expected to cause wait() to throw a RuntimeExce…
1175 …$process = $this->getProcessForCode('$n = 0; while ($n < 3) { file_put_contents(\''.$stream.'\', $…
1185 $this->assertSame($expected, $result);
1204 …$process = $this->getProcessForCode('stream_copy_to_stream(STDIN, STDOUT);', null, null, $input());
1206 $this->assertSame('pingpong', $process->getOutput());
1213 … $process = $this->getProcessForCode('echo \'ping\'; echo fread(STDIN, 4); echo fread(STDIN, 4);');
1226 $this->assertSame('pingpangpong', $process->getOutput());
1249 $process = $this->getProcessForCode('echo fread(STDIN, 3);');
1256 $this->assertSame('123', $process->getOutput());
1267 $process = $this->getProcessForCode('stream_copy_to_stream(STDIN, STDOUT);');
1272 $this->assertSame('pingpong', $process->getOutput());
1281 $process = $this->getProcessForCode('echo 123; echo fread(STDIN, 1); echo 456;');
1290 …$this->assertSame(0, $i, 'InputStream->onEmpty callback should be called only when the input *beco…
1291 $this->assertSame('123456', $process->getOutput());
1298 …$process = $this->getProcessForCode('fwrite(STDOUT, 123); fwrite(STDERR, 234); flush(); usleep(100…
1310 $this->assertSame($expectedOutput, $output);
1318 $this->assertSame('', $process->getOutput());
1319 $this->assertFalse($process->isRunning());
1327 $this->assertSame($expectedOutput, $output);
1334 $process = $this->getProcessForCode('fwrite(STDOUT, fread(STDIN, 3));');
1346 $this->assertSame($expectedOutput, $output);
1356 $this->assertSame('123', $process->getOutput());
1357 $this->assertFalse($process->isRunning());
1363 $this->assertSame($expectedOutput, $output);
1368 $p1 = $this->getProcessForCode('fwrite(STDERR, 123); fwrite(STDOUT, 456);');
1369 $p2 = $this->getProcessForCode('stream_copy_to_stream(STDIN, STDOUT);');
1375 $this->assertSame('123', $p1->getErrorOutput());
1376 $this->assertSame('', $p1->getOutput());
1377 $this->assertSame('', $p2->getErrorOutput());
1378 $this->assertSame('456', $p2->getOutput());
1383 $process = $this->getProcess('echo hello');
1389 $this->assertSame('hello'.\PHP_EOL, $process->getOutput());
1390 $this->assertSame('', $process->getErrorOutput());
1397 $process = $this->getProcess('php -r "echo getenv(\'new_test_var\');"');
1403 $this->assertSame('foo', $process->getOutput());
1404 $this->assertSame('foo', getenv('existing_var'));
1405 $this->assertFalse(getenv('new_test_var'));
1413 …$process = $this->getProcessForCode('echo serialize($_SERVER);', null, ['BAR' => 'BAZ', 'EMPTY' =>…
1423 $this->assertEquals($expected, $env);
1434 $process = $this->getProcessForCode('echo serialize($_SERVER);', null, ['BAR' => 'BAZ']);
1439 $this->assertSame($process, $process->inheritEnvironmentVariables(false));
1440 $this->assertFalse($process->areEnvironmentVariablesInherited());
1448 $this->assertSame($expected, $env);
1459 $this->assertSame($expected, $p->getCommandLine());
1470 $this->assertSame((string) $arg, $p->getOutput());
1483 $this->assertSame((string) $arg, $p->getOutput());
1501 $this->assertSame($expected, str_replace('Standard input code', '-', $p->getOutput()));
1525 $this->assertSame('Foo baR baZ', rtrim($p->getOutput()));
1526 $this->assertSame($env, $p->getEnv());
1531 …$process = $this->getProcess(self::$phpBin.' '.__DIR__.'/ErrorProcessInitiator.php -e '.self::$php…
1535 $this->assertFalse($process->isRunning());
1555 $this->fail('ENHANCE_SIGCHLD must be used together with a sigchild-enabled PHP.');
1557 …$this->assertSame('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigch…
1578 return $this->getProcess([self::$phpBin, '-r', $code], $cwd, $env, $input, $timeout);
1585 $this->markTestSkipped('PHP is compiled with --enable-sigchild.');
1587 $this->expectException('Symfony\Component\Process\Exception\RuntimeException');
1588 $this->expectExceptionMessage('This PHP has been compiled with --enable-sigchild.');