44use CodeIgniter \Test \FeatureResponse ;
55
66/**
7- * @group DatabaseLive
7+ * @group DatabaseLive
8+ * @runTestsInSeparateProcesses
9+ * @preserveGlobalState disabled
810 */
911class FeatureTestCaseTest extends FeatureTestCase
1012{
@@ -14,7 +16,6 @@ protected function setUp()
1416 parent ::setUp ();
1517
1618 $ this ->skipEvents ();
17- $ this ->clean = false ;
1819 }
1920
2021 public function testCallGet ()
@@ -30,9 +31,6 @@ function () {
3031 ]);
3132 $ response = $ this ->get ('home ' );
3233
33- // close open buffer
34- ob_end_clean ();
35-
3634 $ response ->assertSee ('Hello World ' );
3735 $ response ->assertDontSee ('Again ' );
3836 }
@@ -44,7 +42,7 @@ public function testCallSimpleGet()
4442 'add ' ,
4543 'home ' ,
4644 function () {
47- return 'Hello World ' ;
45+ return 'Hello Earth ' ;
4846 },
4947 ],
5048 ]);
@@ -53,7 +51,7 @@ function () {
5351 $ this ->assertInstanceOf (FeatureResponse::class, $ response );
5452 $ this ->assertInstanceOf (\CodeIgniter \HTTP \Response::class, $ response ->response );
5553 $ this ->assertTrue ($ response ->isOK ());
56- $ this ->assertEquals ('Hello World ' , $ response ->response ->getBody ());
54+ $ this ->assertEquals ('Hello Earth ' , $ response ->response ->getBody ());
5755 $ this ->assertEquals (200 , $ response ->response ->getStatusCode ());
5856 }
5957
@@ -64,13 +62,13 @@ public function testCallPost()
6462 'post ' ,
6563 'home ' ,
6664 function () {
67- return 'Hello World ' ;
65+ return 'Hello Mars ' ;
6866 },
6967 ],
7068 ]);
7169 $ response = $ this ->post ('home ' );
7270
73- $ response ->assertSee ('Hello World ' );
71+ $ response ->assertSee ('Hello Mars ' );
7472 }
7573
7674 public function testCallPut ()
@@ -80,13 +78,13 @@ public function testCallPut()
8078 'put ' ,
8179 'home ' ,
8280 function () {
83- return 'Hello World ' ;
81+ return 'Hello Pluto ' ;
8482 },
8583 ],
8684 ]);
8785 $ response = $ this ->put ('home ' );
8886
89- $ response ->assertSee ('Hello World ' );
87+ $ response ->assertSee ('Hello Pluto ' );
9088 }
9189
9290 public function testCallPatch ()
@@ -96,13 +94,13 @@ public function testCallPatch()
9694 'patch ' ,
9795 'home ' ,
9896 function () {
99- return 'Hello World ' ;
97+ return 'Hello Jupiter ' ;
10098 },
10199 ],
102100 ]);
103101 $ response = $ this ->patch ('home ' );
104102
105- $ response ->assertSee ('Hello World ' );
103+ $ response ->assertSee ('Hello Jupiter ' );
106104 }
107105
108106 public function testCallOptions ()
@@ -112,13 +110,13 @@ public function testCallOptions()
112110 'options ' ,
113111 'home ' ,
114112 function () {
115- return 'Hello World ' ;
113+ return 'Hello George ' ;
116114 },
117115 ],
118116 ]);
119117 $ response = $ this ->options ('home ' );
120118
121- $ response ->assertSee ('Hello World ' );
119+ $ response ->assertSee ('Hello George ' );
122120 }
123121
124122 public function testCallDelete ()
@@ -128,13 +126,13 @@ public function testCallDelete()
128126 'delete ' ,
129127 'home ' ,
130128 function () {
131- return 'Hello World ' ;
129+ return 'Hello Wonka ' ;
132130 },
133131 ],
134132 ]);
135133 $ response = $ this ->delete ('home ' );
136134
137- $ response ->assertSee ('Hello World ' );
135+ $ response ->assertSee ('Hello Wonka ' );
138136 }
139137
140138 public function testSession ()
@@ -148,4 +146,43 @@ public function testSession()
148146 $ response ->assertSessionMissing ('popcorn ' );
149147 }
150148
149+ public function testReturns ()
150+ {
151+ $ this ->withRoutes ([
152+ [
153+ 'get ' ,
154+ 'home ' ,
155+ 'Tests\Support\Controllers\Popcorn::index ' ,
156+ ],
157+ ]);
158+ $ response = $ this ->get ('home ' );
159+ $ response ->assertSee ('Hi ' );
160+ }
161+
162+ public function testIgnores ()
163+ {
164+ $ this ->withRoutes ([
165+ [
166+ 'get ' ,
167+ 'home ' ,
168+ 'Tests\Support\Controllers\Popcorn::cat ' ,
169+ ],
170+ ]);
171+ $ response = $ this ->get ('home ' );
172+ $ response ->assertEmpty ($ response ->response ->getBody ());
173+ }
174+
175+ public function testEchoes ()
176+ {
177+ $ this ->withRoutes ([
178+ [
179+ 'get ' ,
180+ 'home ' ,
181+ 'Tests\Support\Controllers\Popcorn::canyon ' ,
182+ ],
183+ ]);
184+ $ response = $ this ->get ('home ' );
185+ $ response ->assertSee ('Hello-o-o ' );
186+ }
187+
151188}
0 commit comments