Also apply the __toString fix to UserInfo
[cacert-mgr.git] / external / ZendFramework-1.9.5 / demos / Zend / Wildfire / public / Boot / Zend-Db-Profiler-Firebug / TestDocExample.php
1 <?php
2
3 require_once('Zend/Loader.php');
4 Zend_Loader::registerAutoload();
5
6 switch($_GET['Example']) {
7
8 case 'WithController':
9
10 $profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
11 $profiler->setEnabled(true);
12 $db = Zend_Db::factory('PDO_SQLITE', array('dbname' => ':memory:'));
13 $db->setProfiler($profiler);
14 Zend_Registry::set('db',$db);
15
16 $controller = Zend_Controller_Front::getInstance();
17 $controller->setParam('useDefaultControllerAlways',true);
18 $controller->setParam('noViewRenderer', true);
19 $controller->setControllerDirectory(dirname(dirname(dirname(dirname(__FILE__)))).'/application/controllers/Boot/Zend-Db-Profiler-Firebug');
20 $controller->dispatch();
21
22 print 'Test Doc Example with Controller';
23 break;
24
25 case 'WithoutController':
26
27 $profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
28 $profiler->setEnabled(true);
29 $db = Zend_Db::factory('PDO_SQLITE', array('dbname' => ':memory:'));
30 $db->setProfiler($profiler);
31
32 $request = new Zend_Controller_Request_Http();
33 $response = new Zend_Controller_Response_Http();
34 $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
35 $channel->setRequest($request);
36 $channel->setResponse($response);
37
38 $db->getConnection()->exec('CREATE TABLE foo (
39 id INTEGNER NOT NULL,
40 col1 VARCHAR(10) NOT NULL
41 )');
42
43 $db->insert('foo', array('id'=>1,'col1'=>'original'));
44
45 $channel->flush();
46 $response->sendHeaders();
47
48 print 'Test Doc Example without Controller';
49 break;
50
51 }