Skip to content

Commit 8506137

Browse files
Add more TestDox tests
1 parent 3f634fd commit 8506137

File tree

3 files changed

+98
-0
lines changed

3 files changed

+98
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\TestFixture\TestDox;
11+
12+
use PHPUnit\Framework\TestCase;
13+
use const PHP_EOL;
14+
15+
final class DiffTest extends TestCase
16+
{
17+
public function testSomethingThatDoesNotWork(): void
18+
{
19+
$this->assertEquals(
20+
'foo' . PHP_EOL . 'bar' . PHP_EOL . 'baz' . PHP_EOL,
21+
'foo' . PHP_EOL . 'baz' . PHP_EOL . 'bar' . PHP_EOL,
22+
);
23+
}
24+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
--TEST--
2+
TestDox: Diff; Colorized
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--no-configuration';
7+
$_SERVER['argv'][] = '--testdox';
8+
$_SERVER['argv'][] = '--colors=always';
9+
$_SERVER['argv'][] = __DIR__ . '/_files/DiffTest.php';
10+
11+
require_once __DIR__ . '/../../bootstrap.php';
12+
13+
PHPUnit\TextUI\Command::main();
14+
--EXPECTF--
15+
PHPUnit %s by Sebastian Bergmann and contributors.
16+
17+
Diff (PHPUnit\TestFixture\TestDox\Diff)
18+
✘ Something that does not work
19+
┐
20+
├ Failed asserting that two strings are equal.
21+
┊ ---·Expected
22+
┊ +++·Actual
23+
┊ @@ @@
24+
┊ 'foo\n
25+
┊ +baz\n
26+
┊ bar\n
27+
┊ -baz\n
28+
┊ '
29+
│
30+
╵ %stests/end-to-end/testdox/_files/DiffTest.php:%d
31+
┴
32+
33+
Time: %s, Memory: %s
34+
35+
36+
FAILURES!
37+
Tests: 1, Assertions: 1, Failures: 1.

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
--TEST--
2+
TestDox: Diff
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--no-configuration';
7+
$_SERVER['argv'][] = '--testdox';
8+
$_SERVER['argv'][] = '--colors=never';
9+
$_SERVER['argv'][] = __DIR__ . '/_files/DiffTest.php';
10+
11+
require_once __DIR__ . '/../../bootstrap.php';
12+
13+
PHPUnit\TextUI\Command::main();
14+
--EXPECTF--
15+
PHPUnit %s by Sebastian Bergmann and contributors.
16+
17+
Diff (PHPUnit\TestFixture\TestDox\Diff)
18+
✘ Something that does not work
19+
20+
│ Failed asserting that two strings are equal.
21+
│ --- Expected
22+
│ +++ Actual
23+
│ @@ @@
24+
'foo\n
25+
│ +baz\n
26+
│ bar\n
27+
│ -baz\n
28+
'
29+
30+
│ %sDiffTest.php:%d
31+
32+
33+
Time: %s, Memory: %s
34+
35+
36+
FAILURES!
37+
Tests: 1, Assertions: 1, Failures: 1.

0 commit comments

Comments
 (0)