@@ -18,12 +18,6 @@ public function _after()
1818 {
1919 }
2020
21- private function assertInRange ($ min , $ actual , $ max )
22- {
23- $ this ->assertGreaterThanOrEqual ($ min , $ actual );
24- $ this ->assertLessThanOrEqual ($ max , $ actual );
25- }
26-
2721 private static function curlInitWith ($ url , array $ params = [])
2822 {
2923 $ ch = curl_init ();
@@ -71,77 +65,53 @@ public function testSimpleSecure()
7165
7266 public function testDelayed ()
7367 {
74- $ start = microtime (true );
7568 Co::wait ($ ch = $ this ->curlInitWith ('http://localhost:8080/fast_hello.php ' ));
76- $ end = microtime (true );
7769 $ this ->curlAssert200OK ($ ch );
78- $ this ->assertInRange (0.1 , $ end - $ start , 0.2 );
7970 }
8071
8172 public function testDelayedSecure ()
8273 {
83- $ start = microtime (true );
8474 Co::wait ($ ch = $ this ->curlInitWith ('https://localhost:8081/fast_hello.php ' ));
85- $ end = microtime (true );
8675 $ this ->curlAssert200OK ($ ch );
87- $ this ->assertInRange (0.11 , $ end - $ start , 0.21 );
8876 }
8977
9078 public function testDelayedGroupSingle ()
9179 {
92- $ start = microtime (true );
9380 Co::wait ($ chs = $ this ->curlsInitWith (5 , 'http://localhost:8080/fast_hello.php ' ));
94- $ end = microtime (true );
9581 $ this ->curlsAssert200OK ($ chs );
96- $ this ->assertInRange (0.12 , $ end - $ start , 0.22 );
9782 }
9883
9984 public function testDelayedGroupSingleSecure ()
10085 {
101- $ start = microtime (true );
10286 Co::wait ($ chs = $ this ->curlsInitWith (5 , 'https://localhost:8081/fast_hello.php ' ));
103- $ end = microtime (true );
10487 $ this ->curlsAssert200OK ($ chs );
105- $ this ->assertInRange (0.12 , $ end - $ start , 0.22 );
10688 }
10789
10890 public function testDelayedGroupDouble ()
10991 {
110- $ start = microtime (true );
11192 Co::wait ($ chs = $ this ->curlsInitWith (10 , 'http://localhost:8080/fast_hello.php ' ));
112- $ end = microtime (true );
11393 $ this ->curlsAssert200OK ($ chs );
114- $ this ->assertInRange (0.28 , $ end - $ start , 0.38 );
11594 }
11695
11796 public function testDelayedGroupDoubleSecure ()
11897 {
119- $ start = microtime (true );
12098 Co::wait ($ chs = $ this ->curlsInitWith (10 , 'https://localhost:8081/fast_hello.php ' ));
121- $ end = microtime (true );
12299 $ this ->curlsAssert200OK ($ chs );
123- $ this ->assertInRange (0.32 , $ end - $ start , 0.42 );
124100 }
125101
126102 public function testDelayedGroupDoubleAtOnce ()
127103 {
128- $ start = microtime (true );
129104 Co::wait ($ chs = $ this ->curlsInitWith (10 , 'http://localhost:8080/fast_hello.php ' ), [
130105 'concurrency ' => 0 ,
131106 ]);
132- $ end = microtime (true );
133107 $ this ->curlsAssert200OK ($ chs );
134- $ this ->assertInRange (0.28 , $ end - $ start , 0.38 );
135108 }
136109
137110 public function testDelayedGroupDoubleAtOnceSecure ()
138111 {
139- $ start = microtime (true );
140112 Co::wait ($ chs = $ this ->curlsInitWith (10 , 'https://localhost:8081/fast_hello.php ' ), [
141113 'concurrency ' => 0 ,
142114 ]);
143- $ end = microtime (true );
144115 $ this ->curlsAssert200OK ($ chs );
145- $ this ->assertInRange (0.32 , $ end - $ start , 0.42 );
146116 }
147117}
0 commit comments