File tree Expand file tree Collapse file tree 4 files changed +108
-0
lines changed Expand file tree Collapse file tree 4 files changed +108
-0
lines changed Original file line number Diff line number Diff line change @@ -11,3 +11,4 @@ Homestead.yaml
11
11
npm-debug.log
12
12
yarn-error.log
13
13
.env
14
+ .phpunit.result.cache
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <phpunit backupGlobals =" false"
3
+ backupStaticAttributes =" false"
4
+ bootstrap =" vendor/autoload.php"
5
+ colors =" true"
6
+ printerClass =" Sempro\PHPUnitPrettyPrinter\PrettyPrinter"
7
+ convertErrorsToExceptions =" true"
8
+ convertNoticesToExceptions =" true"
9
+ convertWarningsToExceptions =" true"
10
+ processIsolation =" false"
11
+ stopOnFailure =" false" >
12
+ <testsuites >
13
+ <testsuite name =" Test suite" >
14
+ <directory suffix =" Test.php" >./tests</directory >
15
+ </testsuite >
16
+ </testsuites >
17
+ <php >
18
+ <env name =" APP_ENV" value =" testing" />
19
+ </php >
20
+ </phpunit >
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Sempro \PHPUnitPrettyPrinter \Tests ;
4
+
5
+ use Exception ;
6
+
7
+ class OutputTest extends \PHPUnit \Framework \TestCase
8
+ {
9
+ public function testSuccess (): void
10
+ {
11
+ $ this ->assertTrue (true );
12
+ }
13
+
14
+ public function testFail (): void
15
+ {
16
+ $ this ->assertTrue (false );
17
+ }
18
+
19
+ public function testError (): void
20
+ {
21
+ throw new Exception ('error ' );
22
+ }
23
+
24
+ public function testSkip (): void
25
+ {
26
+ $ this ->markTestSkipped ('skipped ' );
27
+ }
28
+
29
+ public function testIncomplete (): void
30
+ {
31
+ $ this ->markTestIncomplete ('incomplete ' );
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Sempro \PHPUnitPrettyPrinter \Tests ;
4
+
5
+ class PrinterTest extends \PHPUnit \Framework \TestCase
6
+ {
7
+ public function testFirstTestShouldPass ()
8
+ {
9
+ $ lines = $ this ->getOutput ();
10
+
11
+ $ this ->assertStringContainsString ('✓ success ' , $ lines [4 ]);
12
+ }
13
+
14
+ public function testSecondTestShouldFail ()
15
+ {
16
+ $ lines = $ this ->getOutput ();
17
+
18
+ $ this ->assertStringContainsString ('x fail ' , $ lines [5 ]);
19
+ }
20
+
21
+ public function testThirdTestShouldThrowAnError ()
22
+ {
23
+ $ lines = $ this ->getOutput ();
24
+
25
+ $ this ->assertStringContainsString ('⚈ error ' , $ lines [6 ]);
26
+ }
27
+
28
+ public function testForthTestShouldBeSkipped ()
29
+ {
30
+ $ lines = $ this ->getOutput ();
31
+
32
+ $ this ->assertStringContainsString ('→ skip ' , $ lines [7 ]);
33
+ }
34
+
35
+ public function testFifthTestShouldBeIncomplete ()
36
+ {
37
+ $ lines = $ this ->getOutput ();
38
+
39
+ $ this ->assertStringContainsString ('∅ incomplete ' , $ lines [8 ]);
40
+ }
41
+
42
+ private function getOutput (): array
43
+ {
44
+ $ command = [
45
+ "vendor/bin/phpunit " ,
46
+ "tests/Output.php " ,
47
+ "--printer 'Sempro\PHPUnitPrettyPrinter\PrettyPrinter' " ,
48
+ ];
49
+
50
+ exec (implode (' ' , $ command ), $ out );
51
+
52
+ return $ out ;
53
+ }
54
+ }
You can’t perform that action at this time.
0 commit comments