@@ -32,7 +32,7 @@ public function test00() {
3232 "2: New website language. \n" ,
3333 "3: Quit. <-- \n"
3434 ], $ output );
35- $ this ->assertEquals (0 , $ this ->getExitCode ());
35+ $ this ->assertSameOutput (0 , $ this ->getExitCode ());
3636 }
3737 /**
3838 * @test
@@ -51,7 +51,7 @@ public function testAddDBConnection00() {
5151
5252 $ count = count (App::getConfig ()->getDBConnections ());
5353 $ connName = 'db-connection- ' .$ count ;
54- $ this ->assertEquals ([
54+ $ this ->assertSameOutput ([
5555 "What would you like to add? \n" ,
5656 "0: New database connection. \n" ,
5757 "1: New SMTP connection. \n" ,
@@ -95,7 +95,7 @@ public function testAddDBConnection01() {
9595 $ connName = 'db-connection- ' .count (App::getConfig ()->getDBConnections ());
9696 $ this ->assertEquals (0 , $ runner ->start ());
9797
98- $ this ->assertEquals ([
98+ $ this ->assertSameOutput ([
9999 "What would you like to add? \n" ,
100100 "0: New database connection. \n" ,
101101 "1: New SMTP connection. \n" ,
@@ -141,7 +141,7 @@ public function testAddDBConnection02() {
141141 $ this ->assertEquals (0 , $ runner ->start ());
142142 $ count = count (App::getConfig ()->getDBConnections ());
143143 $ connName = 'db-connection- ' .($ count );
144- $ this ->assertEquals ([
144+ $ this ->assertSameOutput ([
145145 "What would you like to add? \n" ,
146146 "0: New database connection. \n" ,
147147 "1: New SMTP connection. \n" ,
@@ -178,7 +178,7 @@ public function testAddLang00() {
178178 'ltr ' ,
179179 ]);
180180 $ this ->assertEquals (0 , $ runner ->runCommand (new AddCommand ()));
181- $ this ->assertEquals ([
181+ $ this ->assertSameOutput ([
182182 "What would you like to add? \n" ,
183183 "0: New database connection. \n" ,
184184 "1: New SMTP connection. \n" ,
@@ -207,7 +207,7 @@ public function testAddLang01() {
207207 'EN ' ,
208208 ]);
209209 $ this ->assertEquals (0 , $ runner ->runCommand (new AddCommand ()));
210- $ this ->assertEquals ([
210+ $ this ->assertSameOutput ([
211211 "What would you like to add? \n" ,
212212 "0: New database connection. \n" ,
213213 "1: New SMTP connection. \n" ,
@@ -229,7 +229,7 @@ public function testAddLang02() {
229229 ]);
230230
231231 $ this ->assertEquals (-1 , $ runner ->runCommand (new AddCommand ()));
232- $ this ->assertEquals ([
232+ $ this ->assertSameOutput ([
233233 "What would you like to add? \n" ,
234234 "0: New database connection. \n" ,
235235 "1: New SMTP connection. \n" ,
@@ -263,7 +263,7 @@ public function testAddSMTPConnection00() {
263263 ]);
264264 $ this ->assertEquals (0 , $ runner ->start ());
265265 $ connName = 'smtp-connection- ' .count (App::getConfig ()->getSMTPConnections ());
266- $ this ->assertEquals ([
266+ $ this ->assertSameOutput ([
267267 "What would you like to add? \n" ,
268268 "0: New database connection. \n" ,
269269 "1: New SMTP connection. \n" ,
@@ -286,4 +286,14 @@ private function removeClass($classPath) {
286286 $ file = new File (ROOT_PATH .$ classPath .'.php ' );
287287 $ file ->remove ();
288288 }
289+ public function assertSameOutput (array $ expected , array $ actual ) {
290+ $ count1 = count ($ expected );
291+ $ count2 = count ($ actual );
292+
293+ $ loopUpTo = $ count1 >= $ count2 ? $ count2 : $ count1 ;
294+
295+ for ($ x = 0 ; $ x < $ loopUpTo ; $ x ++) {
296+ $ this ->assertStringContainsString ($ expected [$ x ], $ actual [$ x ]);
297+ }
298+ }
289299}
0 commit comments