From 99a2c520c07a0327efe76d281a193c5a622d0db8 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 25 Jan 2012 09:59:17 -0600 Subject: [PATCH] added more view tests. --- tests/cases/laravel/view.test.php | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/tests/cases/laravel/view.test.php b/tests/cases/laravel/view.test.php index caf5406b..111e5322 100644 --- a/tests/cases/laravel/view.test.php +++ b/tests/cases/laravel/view.test.php @@ -50,4 +50,60 @@ public function testEmptyMessageContainerSetOnViewWhenNoErrorsInSession() $this->assertInstanceOf('Laravel\\Messages', $view->data['errors']); } + /** + * Test the View __set method. + * + * @group laravel + */ + public function testDataCanBeSetOnViewsThroughMagicMethods() + { + $view = new View('home.index'); + + $view->comment = 'Taylor'; + + $this->assertEquals('Taylor', $view->data['comment']); + } + + /** + * Test the View __get method. + * + * @group laravel + */ + public function testDataCanBeRetrievedFromViewsThroughMagicMethods() + { + $view = new View('home.index'); + + $view->comment = 'Taylor'; + + $this->assertEquals('Taylor', $view->comment); + } + + /** + * Test the View's ArrayAccess implementation. + * + * @group laravel + */ + public function testDataCanBeSetOnTheViewThroughArrayAccess() + { + $view = new View('home.index'); + + $view['comment'] = 'Taylor'; + + $this->assertEquals('Taylor', $view->data['comment']); + } + + /** + * Test the View's ArrayAccess implementation. + * + * @group laravel + */ + public function testDataCanBeRetrievedThroughArrayAccess() + { + $view = new View('home.index'); + + $view['comment'] = 'Taylor'; + + $this->assertEquals('Taylor', $view['comment']); + } + } \ No newline at end of file