Example #1
0
 /**
  * Tests the run method working correctly and passing parameters to the method.
  */
 public function testRunWithParameters()
 {
     $userId = mt_rand(1, 100);
     $data = array();
     $withDefault = mt_rand(999, 2000);
     $headerWrapper = new HeaderWrapper();
     $this->application->setHeaderWrapper($headerWrapper);
     $this->application->setNamespace('\\LmMvcTests\\Mock');
     $this->application->setRequestUri('/mock_controller/methodwithparams' . '?' . http_build_query(array('userId' => $userId, 'withDefault' => $withDefault)));
     $this->application->run();
     // Make sure no redirect occurred.
     $this->assertFalse($headerWrapper->getSent());
     // Make sure the index was invoked.
     $this->assertNotNull(MockController::getMethodParameters());
     $this->assertEquals(array('userId' => $userId, 'data' => $data, 'withDefault' => $withDefault), MockController::getMethodParameters());
 }