Skip to content

Instantly share code, notes, and snippets.

@GeeH
Created September 15, 2014 17:54
Show Gist options
  • Save GeeH/c853cabfcef901c1c08c to your computer and use it in GitHub Desktop.
Save GeeH/c853cabfcef901c1c08c to your computer and use it in GitHub Desktop.
<?php
use Zend\Http\Request;
use Zend\Http\Response;
use Zend\Mvc\Controller\PluginManager;
use Zend\Mvc\MvcEvent;
use Zend\Mvc\Router\RouteMatch;
/**
* Created by Gary Hockin.
* Date: 14/09/2014
* @GeeH
*/
class UserControllerTest extends PHPUnit_Framework_TestCase
{
/**
* @var \UglyUser\Controller\UserController
*/
private $controller;
/**
* @var RouteMatch
*/
private $routeMatch;
/**
* @var Request
*/
private $request;
/**
* @var MvcEvent
*/
private $event;
/**
* @var PluginManager
*/
private $controllerPluginManager;
public function setUp()
{
$this->controller = new \UglyUser\Controller\UserController();
$this->request = new Request();
$this->routeMatch = new RouteMatch(array('controller' => \UglyUser\Controller\UserController::class));
$this->event = new MvcEvent();
$this->event->setRouteMatch($this->routeMatch);
$this->controllerPluginManager = new PluginManager();
$this->controllerPluginManager->
$this->controller->setEvent($this->event);
$this->controller->setPluginManager($this->controllerPluginManager);
}
public function testNonPostToLoginAction()
{
$this->routeMatch->setParam('action', 'login');
$result = $this->controller->dispatch($this->request);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment