File tree Expand file tree Collapse file tree 5 files changed +52
-38
lines changed
Expand file tree Collapse file tree 5 files changed +52
-38
lines changed Original file line number Diff line number Diff line change 7878 "yiisoft/translator-message-php" : " ^1.1" ,
7979 "yiisoft/view" : " ^12.0" ,
8080 "yiisoft/yii-console" : " ^2.0" ,
81- "yiisoft/yii-debug" : " dev-master|dev-php80 " ,
81+ "yiisoft/yii-debug" : " dev-master" ,
8282 "yiisoft/yii-event" : " ^2.0" ,
8383 "yiisoft/yii-http" : " ^1.0" ,
8484 "yiisoft/yii-middleware" : " ^1.0" ,
8585 "yiisoft/yii-runner-console" : " ^2.0" ,
86- "yiisoft/yii-runner-http" : " ^3.0 " ,
86+ "yiisoft/yii-runner-http" : " ^3.2 " ,
8787 "yiisoft/yii-view-renderer" : " ^7.1"
8888 },
8989 "require-dev" : {
100100 "vimeo/psalm" : " ^5.20" ,
101101 "yiisoft/yii-debug-api" : " 3.0.x-dev" ,
102102 "yiisoft/yii-debug-viewer" : " ^3.0@dev" ,
103- "yiisoft/yii-gii" : " dev-master" ,
104- "yiisoft/yii-testing" : " dev-master"
103+ "yiisoft/yii-gii" : " dev-master"
105104 },
106105 "autoload" : {
107106 "psr-4" : {
Original file line number Diff line number Diff line change 11actor : FunctionalTester
22modules :
3- enabled :
4- step_decorators : ~
3+ enabled :
4+ step_decorators : ~
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace App \Tests \Functional ;
6+
7+ use App \Tests \Support \FunctionalTester ;
8+ use HttpSoft \Message \ServerRequest ;
9+
10+ use function PHPUnit \Framework \assertStringContainsString ;
11+
12+ final class SiteControllerCest
13+ {
14+ public function testGetIndex (FunctionalTester $ tester ): void
15+ {
16+ $ response = $ tester ->sendRequest (
17+ new ServerRequest (uri: '/ ' ),
18+ );
19+
20+ assertStringContainsString (
21+ 'Don \'t forget to check the guide ' ,
22+ $ response ->getBody ()->getContents (),
23+ );
24+ }
25+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 44
55namespace App \Tests \Support ;
66
7+ use Psr \Http \Message \ResponseInterface ;
8+ use Psr \Http \Message \ServerRequestInterface ;
9+ use Yiisoft \Yii \Runner \Http \HttpApplicationRunner ;
10+
11+ use function dirname ;
12+
713/**
814 * Inherited Methods
915 *
@@ -27,4 +33,20 @@ class FunctionalTester extends \Codeception\Actor
2733 /**
2834 * Define custom actions here
2935 */
36+ public function sendRequest (ServerRequestInterface $ request ): ResponseInterface
37+ {
38+ $ runner = new HttpApplicationRunner (
39+ rootPath: dirname (__DIR__ , 2 ),
40+ environment: $ _ENV ['YII_ENV ' ],
41+ );
42+
43+ $ response = $ runner ->runAndGetResponse ($ request );
44+
45+ $ body = $ response ->getBody ();
46+ if ($ body ->isSeekable ()) {
47+ $ body ->rewind ();
48+ }
49+
50+ return $ response ;
51+ }
3052}
You can’t perform that action at this time.
0 commit comments