@@ -25,6 +25,18 @@ class UserPasswordHashCommandTest extends TestCase
2525{
2626 /** @var CommandTester */
2727 private $ passwordHasherCommandTester ;
28+ private $ colSize ;
29+
30+ protected function setUp (): void
31+ {
32+ $ this ->colSize = getenv ('COLUMNS ' );
33+ putenv ('COLUMNS= ' .(119 + \strlen (\PHP_EOL )));
34+ }
35+
36+ protected function tearDown (): void
37+ {
38+ putenv ($ this ->colSize ? 'COLUMNS= ' .$ this ->colSize : 'COLUMNS ' );
39+ }
2840
2941 public function testEncodePasswordEmptySalt ()
3042 {
@@ -287,7 +299,6 @@ public function testThrowsExceptionOnNoConfiguredHashers()
287299
288300 protected function setUp (): void
289301 {
290- putenv ('COLUMNS= ' .(119 + \strlen (\PHP_EOL )));
291302 $ hasherFactory = new PasswordHasherFactory ([
292303 InMemoryUser::class => ['algorithm ' => 'plaintext ' ],
293304 'Custom\Class\Native\User ' => ['algorithm ' => 'native ' , 'cost ' => 10 ],
@@ -308,8 +319,6 @@ protected function tearDown(): void
308319
309320 private function setupArgon2i ()
310321 {
311- putenv ('COLUMNS= ' .(119 + \strlen (\PHP_EOL )));
312-
313322 $ hasherFactory = new PasswordHasherFactory ([
314323 'Custom\Class\Argon2i\User ' => ['algorithm ' => 'argon2i ' ],
315324 ]);
@@ -321,8 +330,6 @@ private function setupArgon2i()
321330
322331 private function setupArgon2id ()
323332 {
324- putenv ('COLUMNS= ' .(119 + \strlen (\PHP_EOL )));
325-
326333 $ hasherFactory = new PasswordHasherFactory ([
327334 'Custom\Class\Argon2id\User ' => ['algorithm ' => 'argon2id ' ],
328335 ]);
@@ -334,8 +341,6 @@ private function setupArgon2id()
334341
335342 private function setupBcrypt ()
336343 {
337- putenv ('COLUMNS= ' .(119 + \strlen (\PHP_EOL )));
338-
339344 $ hasherFactory = new PasswordHasherFactory ([
340345 'Custom\Class\Bcrypt\User ' => ['algorithm ' => 'bcrypt ' ],
341346 ]);
@@ -348,8 +353,6 @@ private function setupBcrypt()
348353
349354 private function setupSodium ()
350355 {
351- putenv ('COLUMNS= ' .(119 + \strlen (\PHP_EOL )));
352-
353356 $ hasherFactory = new PasswordHasherFactory ([
354357 'Custom\Class\Sodium\User ' => ['algorithm ' => 'sodium ' ],
355358 ]);
0 commit comments