public function testAddPage()
 {
     $firstPage = $this->getMock('HTML_QuickForm2_Controller_Page', array('populateForm'), array(new HTML_QuickForm2('firstPage')));
     $controller = new HTML_QuickForm2_Controller('foo');
     try {
         $page = $controller->getPage('firstPage');
         $this->fail('Expected HTML_QuickForm2_NotFoundException was not thrown');
     } catch (HTML_QuickForm2_NotFoundException $e) {
     }
     $controller->addPage($firstPage);
     $this->assertSame($firstPage, $controller->getPage('firstPage'));
     $this->assertSame($controller, $firstPage->getController());
     try {
         $controller->addPage($this->getMock('HTML_QuickForm2_Controller_Page', array('populateForm'), array(new HTML_QuickForm2('firstPage'))));
         $this->fail('Expected HTML_QuickForm2_InvalidArgumentException was not thrown');
     } catch (HTML_QuickForm2_InvalidArgumentException $e) {
     }
 }
 /**
  * Do not add session ID to redirect URL when session.use_only_cookies is set
  *
  * @link http://pear.php.net/bugs/bug.php?id=3443
  */
 public function testBug3443()
 {
     if ('' != session_id()) {
         $this->markTestSkipped('This test cannot be run with session started');
     }
     $old = ini_set('session.use_only_cookies', false);
     define('SID', 'mysessionid=foobar');
     $controller = new HTML_QuickForm2_Controller('testBug3443');
     $controller->addPage($this->getMock('HTML_QuickForm2_Controller_Page', array('populateForm'), array(new HTML_QuickForm2('dest'))));
     $controller->addHandler('jump', $this->mockJump);
     $this->assertContains('mysessionid=', $controller->getPage('dest')->handle('jump'));
     ini_set('session.use_only_cookies', true);
     $this->assertNotContains('mysessionid=', $controller->getPage('dest')->handle('jump'));
     ini_set('session.use_only_cookies', $old);
 }