Advertisement
Guest User

Untitled

a guest
Jan 8th, 2013
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1.   public function setUp()
  2.   {
  3.     $this->controller = new IdeaController();
  4.     $this->request    = new Request();
  5.     $this->routeMatch = new RouteMatch(array('controller' => 'idea'));
  6.     $this->event      = new MvcEvent();
  7.     $this->event->setRouteMatch($this->routeMatch);
  8.     $this->controller->setEvent($this->event);
  9.     $this->controller->setServiceLocator(Bootstrap::getServiceManager());
  10.     $this->routeMatch->setMatchedRouteName('restful');
  11.   }
  12.  
  13.   public function testCreate() {
  14.     $parameters = new Parameters(array('name'=>'A'));
  15.     $this->request->setMethod('POST')
  16.                   ->setPost($parameters);
  17.  
  18.     $result = $this->controller->dispatch($this->request);
  19.     $response  = $this->controller->getResponse();
  20.  
  21.     $this->assertEquals(403, $response->getStatusCode());
  22.     $this->assertArrayHasKey('id', $result);
  23.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement