@@ -40,16 +40,16 @@ private function assertResponseIsOK(Response $response): void
4040 public function testSend (): void
4141 {
4242 $ client = $ this ->createClient ();
43- $ client ->baseUrl = 'https://www.php.net / ' ;
43+ $ client ->baseUrl = 'https://www.yiiframework.com / ' ;
4444 $ response = $ client ->createRequest ()
4545 ->setMethod ('GET ' )
46- ->setUrl ('docs.php ' )
46+ ->setUrl ('doc/guide/2.0/en/start-installation ' )
4747 ->send ();
4848
4949 $ this ->assertResponseIsOK ($ response );
5050 $ content = $ response ->getContent ();
5151 $ this ->assertNotEmpty ($ content );
52- $ this ->assertStringContainsString ('<h1>Documentation</h1> ' , $ content );
52+ $ this ->assertStringContainsString ('The Definitive Guide to Yii 2.0 ' , $ content );
5353 }
5454
5555 /**
@@ -58,13 +58,15 @@ public function testSend(): void
5858 public function testSendPost (): void
5959 {
6060 $ client = $ this ->createClient ();
61- $ client ->baseUrl = 'https://www.php.net / ' ;
61+ $ client ->baseUrl = 'https://postman-echo.com / ' ;
6262 $ response = $ client ->createRequest ()
6363 ->setMethod ('POST ' )
64- ->setUrl ('search.php ' )
65- ->setData (['pattern ' => 'curl ' ])
64+ ->setUrl ('post ' )
65+ ->setData (['q ' => 'yii ' ])
6666 ->send ();
67+
6768 $ this ->assertResponseIsOK ($ response );
69+ $ this ->assertNotEmpty ($ response ->getContent ());
6870 }
6971
7072 /**
@@ -73,15 +75,15 @@ public function testSendPost(): void
7375 public function testBatchSend (): void
7476 {
7577 $ client = $ this ->createClient ();
76- $ client ->baseUrl = 'https://www.php.net / ' ;
78+ $ client ->baseUrl = 'https://www.yiiframework.com / ' ;
7779
7880 $ requests = [];
7981 $ requests ['docs ' ] = $ client ->createRequest ()
8082 ->setMethod ('GET ' )
81- ->setUrl ('docs.php ' );
83+ ->setUrl ('doc/guide/2.0/en/start-installation ' );
8284 $ requests ['support ' ] = $ client ->createRequest ()
8385 ->setMethod ('GET ' )
84- ->setUrl ('support.php ' );
86+ ->setUrl ('community ' );
8587
8688 $ responses = $ client ->batchSend ($ requests );
8789 $ this ->assertCount (count ($ requests ), $ responses );
@@ -93,8 +95,8 @@ public function testBatchSend(): void
9395 $ this ->assertInstanceOf (Response::class, $ responses ['docs ' ]);
9496 $ this ->assertInstanceOf (Response::class, $ responses ['support ' ]);
9597
96- $ this ->assertStringContainsString ('<h1>Documentation</h1> ' , $ responses ['docs ' ]->getContent ());
97- $ this ->assertStringContainsString ('Mailing Lists ' , $ responses ['support ' ]->getContent ());
98+ $ this ->assertStringContainsString ('The Definitive Guide to Yii 2.0 ' , $ responses ['docs ' ]->getContent ());
99+ $ this ->assertStringContainsString ('Community Resources ' , $ responses ['support ' ]->getContent ());
98100 }
99101
100102 /**
@@ -103,15 +105,11 @@ public function testBatchSend(): void
103105 public function testFollowLocation (): void
104106 {
105107 $ client = $ this ->createClient ();
106- $ client ->baseUrl = 'https://www.php.net / ' ;
108+ $ client ->baseUrl = 'https://www.yiiframework.com / ' ;
107109
108110 $ request = $ client ->createRequest ()
109111 ->setMethod ('GET ' )
110- ->setUrl ('search.php ' )
111- ->setData ([
112- 'show ' => 'quickref ' ,
113- 'pattern ' => 'array_merge '
114- ]);
112+ ->setUrl ('doc/guide ' );
115113
116114 $ response = $ request ->setOptions ([
117115 'followLocation ' => false ,
@@ -147,11 +145,11 @@ public function testSendError(): void
147145 public function testSendEvents (): void
148146 {
149147 $ client = $ this ->createClient ();
150- $ client ->baseUrl = 'https://www.php.net / ' ;
148+ $ client ->baseUrl = 'https://www.yiiframework.com / ' ;
151149
152150 $ request = $ client ->createRequest ()
153151 ->setMethod ('GET ' )
154- ->setUrl ('docs.php ' );
152+ ->setUrl ('doc/guide/2.0/en/start-installation ' );
155153
156154 $ beforeSendEvent = null ;
157155 $ request ->on (Request::EVENT_BEFORE_SEND , function (RequestEvent $ event ) use (&$ beforeSendEvent ) {
@@ -180,11 +178,11 @@ public function testSendEvents(): void
180178 public function testClientSendEvents (): void
181179 {
182180 $ client = $ this ->createClient ();
183- $ client ->baseUrl = 'https://www.php.net / ' ;
181+ $ client ->baseUrl = 'https://www.yiiframework.com / ' ;
184182
185183 $ request = $ client ->createRequest ()
186184 ->setMethod ('GET ' )
187- ->setUrl ('docs.php ' );
185+ ->setUrl ('doc/guide/2.0/en/start-installation ' );
188186
189187 $ beforeSendEvent = null ;
190188 $ client ->on (Client::EVENT_BEFORE_SEND , function (RequestEvent $ event ) use (&$ beforeSendEvent ) {
@@ -214,7 +212,7 @@ public function testClientSendEvents(): void
214212 public function testBatchSendEvents (): void
215213 {
216214 $ client = $ this ->createClient ();
217- $ client ->baseUrl = 'https://www.php.net ' ;
215+ $ client ->baseUrl = 'https://www.yiiframework.com ' ;
218216
219217 $ beforeSendUrls = [];
220218 $ client ->on (Client::EVENT_BEFORE_SEND , function (RequestEvent $ event ) use (&$ beforeSendUrls ) {
@@ -229,16 +227,16 @@ public function testBatchSendEvents(): void
229227 $ requests = [];
230228 $ requests ['docs ' ] = $ client ->createRequest ()
231229 ->setMethod ('GET ' )
232- ->setUrl ('docs.php ' );
230+ ->setUrl ('doc/guide/2.0/en/start-installation ' );
233231 $ requests ['support ' ] = $ client ->createRequest ()
234232 ->setMethod ('GET ' )
235- ->setUrl ('support.php ' );
233+ ->setUrl ('community ' );
236234
237235 $ responses = $ client ->batchSend ($ requests );
238236
239237 $ expectedUrls = [
240- $ client ->baseUrl . '/docs.php ' ,
241- $ client ->baseUrl . '/support.php ' ,
238+ $ client ->baseUrl . '/doc/guide/2.0/en/start-installation ' ,
239+ $ client ->baseUrl . '/community ' ,
242240 ];
243241 $ this ->assertEquals ($ expectedUrls , $ beforeSendUrls );
244242 $ this ->assertEquals ($ expectedUrls , $ afterSendUrls );
@@ -291,10 +289,10 @@ public function testCustomSslCertificate(): void
291289 file_put_contents ($ privateKeyFilename , $ privateKey );
292290
293291 $ client = $ this ->createClient ();
294- $ client ->baseUrl = 'https://secure.php.net / ' ;
292+ $ client ->baseUrl = 'https://www.yiiframework.com / ' ;
295293 $ response = $ client ->createRequest ()
296294 ->setMethod ('GET ' )
297- ->setUrl ('docs.php ' )
295+ ->setUrl ('doc/guide/2.0/en/start-installation ' )
298296 ->setOptions ([
299297 'sslLocalCert ' => $ publicKeyFilename ,
300298 'sslLocalPk ' => $ privateKeyFilename ,
@@ -305,6 +303,6 @@ public function testCustomSslCertificate(): void
305303 $ this ->assertResponseIsOK ($ response );
306304 $ content = $ response ->getContent ();
307305 $ this ->assertNotEmpty ($ content );
308- $ this ->assertStringContainsString ('<h1>Documentation</h1> ' , $ content );
306+ $ this ->assertStringContainsString ('The Definitive Guide to Yii 2.0 ' , $ content );
309307 }
310308}
0 commit comments