-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a trait that checks to see if $this->exporter()->export() is avai…
…lable before trying to use it
- Loading branch information
1 parent
895c8d0
commit a5622fe
Showing
5 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace SteveGrunwell\PHPUnit_Markup_Assertions\Constraints; | ||
|
||
/** | ||
* Trait that exposes an exportValue method that will attempt to use | ||
* {@see SebastianBergmann\Exporter\Exporter} when available. | ||
*/ | ||
trait ExporterTrait | ||
{ | ||
private function exportValue($value) | ||
{ | ||
if (method_exists($this, 'exporter')) { | ||
return $this->exporter()->export($value); | ||
} | ||
|
||
return var_export($value, true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters