Skip to content

Commit 3a24d28

Browse files
committed
test: fix assertions for Windows
1 parent 70e49c5 commit 3a24d28

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/Commands/UserTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ private function setMockIo(array $inputs): void
3737
User::setInputOutput($this->io);
3838
}
3939

40+
private function getOutputWithoutColorCode(): string
41+
{
42+
$output = str_replace(["\033[0;32m", "\033[0m"], '', $this->io->getOutputs());
43+
44+
if (is_windows()) {
45+
$output = str_replace("\r\n", "\n", $output);
46+
}
47+
48+
return $output;
49+
}
50+
4051
public function testNoAction(): void
4152
{
4253
$this->setMockIo([]);
@@ -466,7 +477,7 @@ public function testList(): void
466477
467478
468479
',
469-
$this->io->getOutputs()
480+
$this->getOutputWithoutColorCode()
470481
);
471482
}
472483

@@ -491,7 +502,7 @@ public function testListByEmail(): void
491502
'Id User
492503
493504
',
494-
$this->io->getOutputs()
505+
$this->getOutputWithoutColorCode()
495506
);
496507
}
497508

0 commit comments

Comments
 (0)