Skip to content

Commit

Permalink
Fixed ViewDispatcher tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed May 7, 2012
1 parent 16df418 commit 60da699
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions HiMVC/Core/MVC/Tests/ViewDispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testNoConditions()
$dispatcher = new ViewDispatcher( array( 'tpl' => array( $this->viewMock1, 'render' ) ), array() );
$dispatcher->view(
$this->request,
$this->getResultItem( array(), 'full' )
$this->getResultItem( array(), array( 'view' => 'full' ) )
);

$this->viewMock2->expects( $this->once() )
Expand All @@ -84,7 +84,7 @@ public function testNoConditions()
$dispatcher = new ViewDispatcher( array( 'php' => array( $this->viewMock2, 'render' ) ), array() );
$dispatcher->view(
$this->request,
$this->getResultItem( array(), '' )
$this->getResultItem( array() )
);
}

Expand Down Expand Up @@ -112,7 +112,7 @@ public function testVerySimpleCondition()
) );
$dispatcher->view(
$this->request,
$this->getResultItem( array(), 'full', $params )
$this->getResultItem( array(), $params + array( 'view' => 'full' ) )
);

$this->viewMock2->expects( $this->once() )
Expand All @@ -130,7 +130,7 @@ public function testVerySimpleCondition()
) );
$dispatcher->view(
$this->request,
$this->getResultItem( array(), '', $params )
$this->getResultItem( array(), $params )
);
}

Expand Down Expand Up @@ -164,7 +164,7 @@ public function testSimpleCondition()
) );
$dispatcher->view(
$this->request,
$this->getResultItem( array(), 'full', $params )
$this->getResultItem( array(), $params + array( 'view' => 'full' ) )
);

$this->viewMock2->expects( $this->once() )
Expand All @@ -187,25 +187,23 @@ public function testSimpleCondition()
) );
$dispatcher->view(
$this->request,
$this->getResultItem( array(), '', $params )
$this->getResultItem( array(), $params )
);
}

/**
* @param object $model
* @param string $view
* @param array $params
* @param string $action
* @param string $controller
* @return \HiMVC\API\MVC\Values\ResultItem
*/
protected function getResultItem( $model, $view = '', array $params = array(), $action = 'read', $controller = __CLASS__ )
protected function getResultItem( $model, array $params = array(), $action = 'read', $controller = __CLASS__ )
{
return new ResultItem( array(
'model' => $model,
'module' => 'content',
'action' => $action,
'view' => $view,
'controller' => $controller,
'params' => $params
) );
Expand Down

0 comments on commit 60da699

Please sign in to comment.