Skip to content

Commit e4c3197

Browse files
jrfnlsebastianbergmann
authored andcommitted
E2E/diff-colorized: add separate test for Windows
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.
1 parent f50f5b4 commit e4c3197

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
--TEST--
2+
TestDox: Diff; Colorized; Windows
3+
--SKIPIF--
4+
<?php declare(strict_types=1);
5+
if (stripos(\PHP_OS, 'WIN') !== 0) {
6+
print 'skip: Colorized diff is different on *nix systems.';
7+
}
8+
--FILE--
9+
<?php declare(strict_types=1);
10+
$_SERVER['argv'][] = '--do-not-cache-result';
11+
$_SERVER['argv'][] = '--no-configuration';
12+
$_SERVER['argv'][] = '--testdox';
13+
$_SERVER['argv'][] = '--colors=always';
14+
$_SERVER['argv'][] = __DIR__ . '/_files/DiffTest.php';
15+
16+
require_once __DIR__ . '/../../bootstrap.php';
17+
18+
PHPUnit\TextUI\Command::main();
19+
--EXPECTF--
20+
PHPUnit %s by Sebastian Bergmann and contributors.
21+
22+
Diff (PHPUnit\TestFixture\TestDox\Diff)
23+
✘ Something that does not work
24+
┐
25+
├ Failed asserting that two strings are equal.
26+
├ --- Expected 
27+
├ +++ Actual 
28+
├ @@ @@ 
29+
├  'foo\n 
30+
├ +baz\n 
31+
├  bar\n 
32+
├ -baz\n 
33+
├  ' 
34+
│
35+
╵ %stests%eend-to-end%etestdox%e_files%eDiffTest.php:%d
36+
┴
37+
38+
Time: %s, Memory: %s
39+
40+
41+
FAILURES!
42+
Tests: 1, Assertions: 1, Failures: 1.

tests/end-to-end/testdox/diff-colorized.phpt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
--TEST--
2-
TestDox: Diff; Colorized
2+
TestDox: Diff; Colorized; *nix
3+
--SKIPIF--
4+
<?php declare(strict_types=1);
5+
if (stripos(\PHP_OS, 'WIN') === 0) {
6+
print 'skip: Colorized diff is different on Windows.';
7+
}
38
--FILE--
49
<?php declare(strict_types=1);
510
$_SERVER['argv'][] = '--do-not-cache-result';

0 commit comments

Comments
 (0)