Skip to content

Commit

Permalink
E2E/diff-colorized: add separate test for Windows
Browse files Browse the repository at this point in the history
The colorized diff display on Windows is different from *nix systems.

This commit:
* Adds a test skip for the pre-existing test when the tests are run on Windows.
* Adds a separate test for the colorized diff display on Windows, which is skipped when running on *nix systems.
  • Loading branch information
jrfnl authored and sebastianbergmann committed Sep 4, 2023
1 parent f50f5b4 commit e4c3197
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
42 changes: 42 additions & 0 deletions tests/end-to-end/testdox/diff-colorized-windows.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
--TEST--
TestDox: Diff; Colorized; Windows
--SKIPIF--
<?php declare(strict_types=1);
if (stripos(\PHP_OS, 'WIN') !== 0) {
print 'skip: Colorized diff is different on *nix systems.';
}
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--testdox';
$_SERVER['argv'][] = '--colors=always';
$_SERVER['argv'][] = __DIR__ . '/_files/DiffTest.php';

require_once __DIR__ . '/../../bootstrap.php';

PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Diff (PHPUnit\TestFixture\TestDox\Diff)
✘ Something that does not work
┐
├ Failed asserting that two strings are equal.
├ --- Expected 
├ +++ Actual 
├ @@ @@ 
├  'foo\n 
├ +baz\n 
├  bar\n 
├ -baz\n 
├  ' 
│
╵ %stests%eend-to-end%etestdox%e_files%eDiffTest.php:%d
┴

Time: %s, Memory: %s


FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
7 changes: 6 additions & 1 deletion tests/end-to-end/testdox/diff-colorized.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
--TEST--
TestDox: Diff; Colorized
TestDox: Diff; Colorized; *nix
--SKIPIF--
<?php declare(strict_types=1);
if (stripos(\PHP_OS, 'WIN') === 0) {
print 'skip: Colorized diff is different on Windows.';
}
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
Expand Down

0 comments on commit e4c3197

Please sign in to comment.