コード例 #1
0
 /**
  * direct() is an alias for goto(), which is an alias for setGoto()
  */
 public function testDirect()
 {
     $request = $this->request;
     $request->setModuleName('blog')->setControllerName('list')->setActionName('all');
     $this->redirector->direct('error');
     $this->assertEquals('/blog/list/error', $this->redirector->getRedirectUrl());
 }
コード例 #2
0
ファイル: RedirectorTest.php プロジェクト: lortnus/zf1
 public function testPassingDefaultModuleShouldNotRenderModuleNameInRedirectUrl()
 {
     $this->request->setModuleName('admin')->setControllerName('class')->setActionName('view');
     $this->redirector->gotoSimple('login', 'account', 'default');
     $test = $this->redirector->getRedirectUrl();
     $this->assertEquals('/account/login', $test, $test);
 }
コード例 #3
0
 /** @group ZF-6025 */
 public function testGotoSimpleShouldNotHardcodeControllerActionModuleKeys()
 {
     $this->request->setControllerKey('foo')->setActionKey('bar')->setModuleKey('baz');
     $this->router->removeRoute('default');
     $this->router->addRoute('default', new Zend_Controller_Router_Route(':baz/:foo/:bar/*', array('baz' => 'default', 'foo' => 'index', 'bar' => 'index')));
     $this->redirector->gotoSimple('babar', 'barbapapa', 'barbazoo', array('asd' => 1));
     $result = $this->redirector->getRedirectUrl();
     $expected = '/barbazoo/barbapapa/babar/asd/1';
     $this->assertEquals($expected, $result);
 }
コード例 #4
0
ファイル: RedirectorTest.php プロジェクト: nbcutech/o3drupal
 /**
  * @group ZF-10364
  */
 public function testGotoSimpleDefaultModuleRedirectsToDefaultModule()
 {
     $this->controller->getFrontController()->setDefaultModule('test')->setDefaultControllerName('test')->setDefaultAction('test');
     $this->redirector->gotoSimple('test', 'test', 'test');
     $result = $this->redirector->getRedirectUrl();
     $expected = '/';
     $this->assertEquals($expected, $result);
     $this->redirector->gotoSimple('index', 'index', 'default');
     $result = $this->redirector->getRedirectUrl();
     $expected = '/default/index/index';
     $this->assertEquals($expected, $result);
 }
コード例 #5
0
ファイル: RedirectorTest.php プロジェクト: rexmac/zf2
 /**
  * @group ZF-4318
  */
 public function testServerVariableHttpsToOffDoesNotBuildHttpsUrl()
 {
     // Set Preconditions from Issue:
     $_SERVER['HTTPS'] = "off";
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['SERVER_PORT'] = 80;
     $this->redirector->setUseAbsoluteUri(true);
     $this->request->setModuleName('admin')->setControllerName('class')->setActionName('view');
     $this->redirector->gotoUrl('/bar/baz');
     $test = $this->redirector->getRedirectUrl();
     $this->assertNotContains('https://', $test);
     $this->assertEquals('http://localhost/bar/baz', $test);
 }
コード例 #6
0
 /**
  * ZF-2602
  */
 public function testPassingEmptyStringToGotoUrlRedirectsToRoot()
 {
     $this->redirector->gotoUrl('');
     $this->assertEquals('/', $this->redirector->getRedirectUrl());
 }