public function testDoDispatch() { $forward = new WindForward(); $forward->setIsReAction(true); $forward->setAction('/long/test'); ob_start(); $this->front->createApplication()->doDispatch($forward); $this->assertEquals(ob_get_clean(), 'LongController-test'); }
/** * Tests WindDispatcher->dispatch() */ public function testDispatch() { $_SERVER['SCRIPT_FILENAME'] = "index.php"; $_SERVER['SCRIPT_NAME'] = 'index.php'; $_SERVER['HTTP_HOST'] = 'localhost'; $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_FILENAME'] . '?c=long&a=noPrint'; $front = Wind::application('long', array('web-apps' => array('long' => array('modules' => array('default' => array('controller-path' => 'data', 'controller-suffix' => 'Controller', 'error-handler' => 'TEST:data.ErrorControllerTest'))))))->run(); $forward = new WindForward(); $forward->setIsReAction(true); $forward->setAction('/long/test'); ob_start(); Wind::getApp()->doDispatch($forward); $this->assertEquals(ob_get_clean(), 'LongController-test'); }
/** * Tests WindForwardException->__construct() */ public function test__construct() { $f1 = new WindForward(); $f1->setIsReAction(true); $f2 = new WindForward(); $f2->setIsReAction(false); try { throw new WindForwardException($f1); } catch (Exception $e) { $this->assertEquals("WindForwardException", get_class($e)); $this->assertEquals($f1, $e->getForward()); $e->setForward($f2); $this->assertEquals($f2, $e->getForward()); $this->assertNotEquals($f1, $e->getForward()); } }