@@ -550,7 +550,7 @@ public function testIdleTimeout()
550
550
{
551
551
$ process = $ this ->getProcess ('sleep 3 ' );
552
552
$ process ->setTimeout (10 );
553
- $ process ->setIdleTimeout (1 );
553
+ $ process ->setIdleTimeout (0.5 );
554
554
555
555
try {
556
556
$ process ->run ();
@@ -559,7 +559,7 @@ public function testIdleTimeout()
559
559
} catch (ProcessTimedOutException $ ex ) {
560
560
$ this ->assertTrue ($ ex ->isIdleTimeout ());
561
561
$ this ->assertFalse ($ ex ->isGeneralTimeout ());
562
- $ this ->assertEquals (1.0 , $ ex ->getExceededTimeout ());
562
+ $ this ->assertEquals (0.5 , $ ex ->getExceededTimeout ());
563
563
}
564
564
}
565
565
@@ -568,32 +568,32 @@ public function testIdleTimeout()
568
568
*/
569
569
public function testIdleTimeoutNotExceededWhenOutputIsSent ()
570
570
{
571
- $ process = $ this ->getProcess ('echo "foo" && sleep 1 && echo "foo" && sleep 1 && echo "foo" && sleep 1 && echo "foo" && sleep 5 ' );
572
- $ process ->setTimeout (5 );
573
- $ process ->setIdleTimeout (3 );
571
+ $ process = $ this ->getProcess ('echo "foo" && sleep 1 && echo "foo" && sleep 1 && echo "foo" && sleep 1 ' );
572
+ $ process ->setTimeout (2 );
573
+ $ process ->setIdleTimeout (1.5 );
574
574
575
575
try {
576
576
$ process ->run ();
577
577
$ this ->fail ('A timeout exception was expected. ' );
578
578
} catch (ProcessTimedOutException $ ex ) {
579
579
$ this ->assertTrue ($ ex ->isGeneralTimeout ());
580
580
$ this ->assertFalse ($ ex ->isIdleTimeout ());
581
- $ this ->assertEquals (5.0 , $ ex ->getExceededTimeout ());
581
+ $ this ->assertEquals (2 , $ ex ->getExceededTimeout ());
582
582
}
583
583
}
584
584
585
585
public function testStartAfterATimeout ()
586
586
{
587
587
$ process = $ this ->getProcess ('php -r "while (true) {echo \'\'; usleep(1000); }" ' );
588
- $ process ->setTimeout (0.1 );
588
+ $ process ->setTimeout (0.2 );
589
589
try {
590
590
$ process ->run ();
591
591
$ this ->fail ('An exception should have been raised. ' );
592
592
} catch (\Exception $ e ) {
593
593
594
594
}
595
595
$ process ->start ();
596
- usleep (10000 );
596
+ usleep (1000 );
597
597
$ process ->stop ();
598
598
}
599
599
@@ -737,6 +737,29 @@ public function testEnableOrDisableOutputAfterRunDoesNotThrowException()
737
737
$ p ->disableOutput ();
738
738
}
739
739
740
+ public function testDisableOutputWhileIdleTimeoutIsSet ()
741
+ {
742
+ $ process = $ this ->getProcess ('sleep 3 ' );
743
+ $ process ->setIdleTimeout (1 );
744
+ $ this ->setExpectedException ('Symfony\Component\Process\Exception\LogicException ' , 'Output can not be disabled while an idle timeout is set. ' );
745
+ $ process ->disableOutput ();
746
+ }
747
+
748
+ public function testSetIdleTimeoutWhileOutputIsDisabled ()
749
+ {
750
+ $ process = $ this ->getProcess ('sleep 3 ' );
751
+ $ process ->disableOutput ();
752
+ $ this ->setExpectedException ('Symfony\Component\Process\Exception\LogicException ' , 'Idle timeout can not be set while the output is disabled. ' );
753
+ $ process ->setIdleTimeout (1 );
754
+ }
755
+
756
+ public function testSetNullIdleTimeoutWhileOutputIsDisabled ()
757 + {
758
+ $ process = $ this ->getProcess ('sleep 3 ' );
759
+ $ process ->disableOutput ();
760
+ $ process ->setIdleTimeout (null );
761
+ }
762
+
740
763
/**
741
764
* @dataProvider provideStartMethods
742
765
*/
0 commit comments