From f5549934fea1b0239c2f085fd5681bbaa3355694 Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Fri, 8 Jan 2016 11:19:56 -0500 Subject: [PATCH] Fix view tests --- tests/Ion/View/HtmlViewTest.php | 4 +-- tests/Ion/View/HttpViewTest.php | 38 +++++++++++++++++++++++-- tests/Ion/ViewTest.php | 49 --------------------------------- 3 files changed, 37 insertions(+), 54 deletions(-) delete mode 100644 tests/Ion/ViewTest.php diff --git a/tests/Ion/View/HtmlViewTest.php b/tests/Ion/View/HtmlViewTest.php index 5599f313..53f20f59 100644 --- a/tests/Ion/View/HtmlViewTest.php +++ b/tests/Ion/View/HtmlViewTest.php @@ -1,8 +1,8 @@ assertEquals('/foo', $this->friend->response->headers->get('Location')); $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('

'); + $this->assertEquals($same, $this->view); + $this->assertEquals('

', $this->view->getOutput()); + } + + public function testAppendOutput() + { + $this->view->setOutput('

'); + $this->view->appendOutput('

'); + $this->assertEquals('

', $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()); + } } \ No newline at end of file diff --git a/tests/Ion/ViewTest.php b/tests/Ion/ViewTest.php deleted file mode 100644 index e51c49c4..00000000 --- a/tests/Ion/ViewTest.php +++ /dev/null @@ -1,49 +0,0 @@ -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('

'); - $this->assertEquals($same, $this->view); - $this->assertEquals('

', $this->view->getOutput()); - } - - public function testAppendOutput() - { - $this->view->setOutput('

'); - $this->view->appendOutput('

'); - $this->assertEquals('

', $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()); - } -} \ No newline at end of file