Skip to content

Commit

Permalink
fixes #122, possible fix for #118
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeerickson committed Sep 28, 2018
1 parent 3d57739 commit ebb19aa
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 22 deletions.
40 changes: 22 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# CD PHPUnit Pretty Result Printer
# CD PHPUnit Pretty Result Printer
#### Version 0.21.0

Extend the default PHPUnit Result Printer with a modern, pretty printer!

Expand Down Expand Up @@ -53,6 +54,9 @@ If you have AnyBar installed, it will be enabled by default. You can disable us

[https://github.com/tonsky/AnyBar](https://github.com/tonsky/AnyBar)

**Anybar is off by default, thus you will need to set the `cd-printer-anybar` option in the `phpunit-printer.yml` to `true` if you wish to use Anybar.
This has been done to address issues with using CI tools such as travis (please see [Issue 122](https://github.com/mikeerickson/phpunit-pretty-result-printer/issues/122) for details) **

_NOTE: AnyBar is only available with PHPUnit 7.1 or greater.
If you need support for previous versions, please let us know. We are slowly deprecating versions before 7.1._

Expand All @@ -62,27 +66,27 @@ If you need support for previous versions, please let us know. We are slowly de
The following options are available (along with their default values):

#### Options ####
---|---|----
**Property Name** | **Default** | **Description**
`cd-printer-hide-class` | false | Hides the display of the test class name
`cd-printer-simple-output`| false | Uses the default PHPUnit markers (but still uses Printer)
`cd-printer-show-config`| true | Show path to used configuration file
`cd-printer-hide-namespace`| false |Hide test class namespaces (will only show print class name)
`cd-printer-anybar`| true |Enable AnyBar (if anybar is not installed, settings will be ignored)
`cd-printer-anybar-port`| 1738 |Define AnyBar port number

| **Property Name** | **Default** | **Description**
| ------------------|-------------|----------------|
| `cd-printer-hide-class` | false | Hides the display of the test class name
| `cd-printer-simple-output`| false | Uses the default PHPUnit markers (but still uses Printer)
| `cd-printer-show-config`| true | Show path to used configuration file
| `cd-printer-hide-namespace`| false |Hide test class namespaces (will only show print class name)
| `cd-printer-anybar`| true |Enable AnyBar (if anybar is not installed, settings will be ignored)
| `cd-printer-anybar-port`| 1738 |Define AnyBar port number

#### Markers ###
You can customize the markers which are used for `success`, `fail`, `error`, `skipped`, `incomplete` by modifying the `phpunit-printer.yml` file.

---|---
**Marker** | **Value** *

cd-pass | "✓ "
cd-fail | "✖ "
cd-error | "⚈ "
cd-skipped | "→ "
cd-incomplete | "∅ "
cd-risky | "⌽ "
| **Marker** | **Value** *
|---------------|----------|
| cd-pass | "✓ " |
| cd-fail | "✖ " |
| cd-error | "⚈ " |
| cd-skipped | "→ " |
| cd-incomplete | "∅ " |
| cd-risky | "⌽ " |

_* Notice space after each marker. This makes the output a little more visually appealing, thus keep that in mind when creating your own custom markers_

Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codedungeon/phpunit-result-printer",
"version": "0.20.3",
"version": "0.21.0",
"description": "PHPUnit Pretty Result Printer",
"keywords": [
"phpunit",
Expand Down Expand Up @@ -33,7 +33,8 @@
"autoload": {
"psr-4": {
"Codedungeon\\PHPUnitPrettyResultPrinter\\": "src/"
}
},
"files": ["init.php","phpunit-printer.yml"]
},
"scripts": {
"coverage-report": "open ./coverage/index.html",
Expand Down
2 changes: 1 addition & 1 deletion phpunit-printer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ options:
cd-printer-simple-output: false
cd-printer-show-config: true
cd-printer-hide-namespace: false
cd-printer-anybar: true
cd-printer-anybar: false
cd-printer-anybar-port: 1738
markers:
cd-pass: ""
Expand Down
2 changes: 1 addition & 1 deletion src/ResultPrinter71.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected function printFooter(TestResult $result): void
$phanyBar = new Phanybar();
if (sizeof($result->failures())) {
// if errors, we will always show red bar
$phanyBar->send('red', $this->anyBarPort);
$phanyBar->send('exclamation', $this->anyBarPort);
} else {
// if no errors and successful, show green
if ($result->wasSuccessful()) {
Expand Down
8 changes: 8 additions & 0 deletions tests/Unit/PrinterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,12 @@ public function should_use_configuration_file(): void
$this->assertContains('phpunit-printer.yml', $this->printer->getConfigurationFile());
$this->assertFileExists($this->printer->getConfigurationFile());
}
/** @test */
public function should_throw_an_error()
{
// this is toggled to assure failure testing and reporting
$this->assertTrue(true);

}

}

0 comments on commit ebb19aa

Please sign in to comment.