-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace Test; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\Console\Input\ArgvInput; | ||
use Symfony\Component\Console\Output\StreamOutput; | ||
use Symfony\Component\Console\Helper\FormatterHelper; | ||
use Symfony\Component\Console\Tester\TesterTrait; | ||
use BlueConsole\Style; | ||
|
||
class StyleTest extends TestCase | ||
{ | ||
use TesterTrait; | ||
|
||
/** | ||
* @var Style | ||
*/ | ||
protected $style; | ||
|
||
/** | ||
* @var StreamOutput | ||
*/ | ||
private $output; | ||
|
||
public function setUp() | ||
{ | ||
$input = new ArgvInput; | ||
$this->output = new StreamOutput(fopen('php://memory', 'w+', false)); | ||
$formatter = new FormatterHelper; | ||
$this->style = new Style($input, $this->output, $formatter); | ||
} | ||
|
||
public function testWarningMessage() | ||
{ | ||
$this->style->warningMessage('Warning message'); | ||
$this->assertEquals($this->getDisplay(), "[WARNING] Warning message\n"); | ||
} | ||
|
||
public function testErrorMessage() | ||
{ | ||
$this->style->errorMessage('Error message'); | ||
$this->assertEquals($this->getDisplay(), "[ERROR] Error message\n"); | ||
} | ||
|
||
public function testOkMessage() | ||
{ | ||
$this->style->okMessage('Ok message'); | ||
$this->assertEquals($this->getDisplay(), "[OK] Ok message\n"); | ||
} | ||
|
||
public function testInfoMessage() | ||
{ | ||
$this->style->infoMessage('Info message'); | ||
$this->assertEquals($this->getDisplay(), "[INFO] Info message\n"); | ||
} | ||
} |