Skip to content

Commit

Permalink
Added some basic tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chajr committed Nov 9, 2018
1 parent f18803a commit 103f3ca
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions tests/StyleTest.php
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");
}
}

0 comments on commit 103f3ca

Please sign in to comment.