Fix view tests
This commit is contained in:
parent
45b04105f1
commit
557b27ef77
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
include_once __DIR__ . "/../ViewTest.php";
|
include_once __DIR__ . "HttpViewTest.php";
|
||||||
|
|
||||||
class HtmlViewTest extends ViewTest {
|
class HtmlViewTest extends HttpViewTest {
|
||||||
|
|
||||||
protected $template_path;
|
protected $template_path;
|
||||||
|
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
include_once __DIR__ . "/../ViewTest.php";
|
|
||||||
|
|
||||||
use Aviat\Ion\Friend;
|
use Aviat\Ion\Friend;
|
||||||
|
|
||||||
class HttpViewTest extends ViewTest {
|
class HttpViewTest extends AnimeClient_TestCase {
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
@ -19,4 +17,38 @@ class HttpViewTest extends ViewTest {
|
|||||||
$this->assertEquals('/foo', $this->friend->response->headers->get('Location'));
|
$this->assertEquals('/foo', $this->friend->response->headers->get('Location'));
|
||||||
$this->assertEquals(303, $this->friend->response->status->getCode());
|
$this->assertEquals(303, $this->friend->response->status->getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetOutput()
|
||||||
|
{
|
||||||
|
$this->friend->output = 'foo';
|
||||||
|
$this->assertEquals($this->friend->output, $this->friend->getOutput());
|
||||||
|
$this->assertFalse($this->friend->hasRendered);
|
||||||
|
|
||||||
|
$this->assertEquals($this->friend->getOutput(), $this->friend->__toString());
|
||||||
|
$this->assertTrue($this->friend->hasRendered);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetOutput()
|
||||||
|
{
|
||||||
|
$same = $this->view->setOutput('<h1></h1>');
|
||||||
|
$this->assertEquals($same, $this->view);
|
||||||
|
$this->assertEquals('<h1></h1>', $this->view->getOutput());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAppendOutput()
|
||||||
|
{
|
||||||
|
$this->view->setOutput('<h1>');
|
||||||
|
$this->view->appendOutput('</h1>');
|
||||||
|
$this->assertEquals('<h1></h1>', $this->view->getOutput());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testOutput()
|
||||||
|
{
|
||||||
|
$this->friend->contentType = 'text/html';
|
||||||
|
$this->friend->__destruct();
|
||||||
|
$content =& $this->friend->response->content;
|
||||||
|
$this->assertEquals($content->getType(), $this->friend->contentType);
|
||||||
|
$this->assertEquals($content->getCharset(), 'utf-8');
|
||||||
|
$this->assertEquals($content->get(), $this->friend->getOutput());
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,49 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Aura\Web\WebFactory;
|
|
||||||
use Aviat\Ion\Friend;
|
|
||||||
|
|
||||||
class ViewTest extends AnimeClient_TestCase {
|
|
||||||
|
|
||||||
public function setUp()
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
$this->view = new TestView($this->container);
|
|
||||||
$this->friend = new Friend($this->view);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testGetOutput()
|
|
||||||
{
|
|
||||||
$this->friend->output = 'foo';
|
|
||||||
$this->assertEquals($this->friend->output, $this->friend->getOutput());
|
|
||||||
$this->assertFalse($this->friend->hasRendered);
|
|
||||||
|
|
||||||
$this->assertEquals($this->friend->getOutput(), $this->friend->__toString());
|
|
||||||
$this->assertTrue($this->friend->hasRendered);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSetOutput()
|
|
||||||
{
|
|
||||||
$same = $this->view->setOutput('<h1></h1>');
|
|
||||||
$this->assertEquals($same, $this->view);
|
|
||||||
$this->assertEquals('<h1></h1>', $this->view->getOutput());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testAppendOutput()
|
|
||||||
{
|
|
||||||
$this->view->setOutput('<h1>');
|
|
||||||
$this->view->appendOutput('</h1>');
|
|
||||||
$this->assertEquals('<h1></h1>', $this->view->getOutput());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testOutput()
|
|
||||||
{
|
|
||||||
$this->friend->contentType = 'text/html';
|
|
||||||
$this->friend->__destruct();
|
|
||||||
$content =& $this->friend->response->content;
|
|
||||||
$this->assertEquals($content->getType(), $this->friend->contentType);
|
|
||||||
$this->assertEquals($content->getCharset(), 'utf-8');
|
|
||||||
$this->assertEquals($content->get(), $this->friend->getOutput());
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user