Skip to content

Commit

Permalink
Unit testing Response
Browse files Browse the repository at this point in the history
  • Loading branch information
R11T committed Dec 30, 2014
1 parent 7af117d commit 2d0e153
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions Test/Unit/App/Library/Io/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
namespace Test\Unit\App\Library\Io;

use \atoum;
use \Test\Unit\TestCase;
use \App\Library\Io\Response as _Response;

/**
Expand All @@ -14,7 +14,7 @@
* @author Romain L.
* @see \App\Library\Io\Response;
*/
class Response extends atoum
class Response extends TestCase
{
/**
* Tests displaying data as a string
Expand All @@ -24,21 +24,14 @@ class Response extends atoum
*/
public function testDisplayWithString()
{
$data = 'This is a string';
$response = new _Response();
$this->mockGenerator->orphanize('__construct');
$item = new \mock\App\Item\Browser;
$item->getMockController()->display = 'Allons-y';
$response = new _Response();
$collection = new \mock\App\Library\Collection($item);

$this->output(function () use ($response, $data) {
$response->display($data);
})->isIdenticalTo("This is a string\n");
$this->output(function () use ($response, $collection) {
$response->display($collection);
})->isIdenticalTo("Allons-y\n");
}

public function testDisplayWithArray()
{
$data = ['Allons-y', 'Geronimo'];
$response = new _Response();

$this->output(function () use ($response, $data) {
$response->display($data);
})->isIdenticalTo("Allons-y\nGeronimo\n");
}
}

0 comments on commit 2d0e153

Please sign in to comment.