Changeset 8460
- Timestamp:
- 04/15/08 01:17:55 (1 year ago)
- Files:
-
- branches/1.1/test/functional/fixtures/project/apps/frontend/config/frontendConfiguration.class.php (modified) (1 diff)
- branches/1.1/test/functional/fixtures/project/apps/frontend/modules/format/actions/actions.class.php (modified) (2 diffs)
- branches/1.1/test/functional/formatTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/test/functional/fixtures/project/apps/frontend/config/frontendConfiguration.class.php
r7962 r8460 5 5 public function configure() 6 6 { 7 $this->dispatcher->connect('view.configure_format', 'configure_format_foo'); 8 $this->dispatcher->connect('request.filter_parameters', 'filter_parameters'); 9 $this->dispatcher->connect('view.configure_format', 'configure_iphone_format'); 7 10 } 8 11 } branches/1.1/test/functional/fixtures/project/apps/frontend/modules/format/actions/actions.class.php
r8227 r8460 11 11 class formatActions extends sfActions 12 12 { 13 static protected $registered = false;14 15 13 public function executeIndex($request) 16 14 { 17 if (!self::$registered)18 {19 // in real code, register view.configure_format events in ProjectConfiguration or XXXApplicationConfiguration, not here!20 self::$registered = true;21 $this->getContext()->getEventDispatcher()->connect('view.configure_format', array($this, 'configureFormat'));22 }23 24 15 if ('xml' == $request->getRequestFormat()) 25 16 { … … 42 33 $this->setTemplate('index'); 43 34 } 44 45 public function configureFormat(sfEvent $event)46 {47 if ('foo' != $event['format'])48 {49 return;50 }51 52 $event['response']->setHttpHeader('x-foo', 'true');53 $event->getSubject()->setExtension('.php');54 }55 35 } branches/1.1/test/functional/formatTest.php
r8227 r8460 84 84 $b->test()->is($b->getResponse()->getContent(), 'A js file', 'response content is ok'); 85 85 86 $b->getContext()->getEventDispatcher()->connect('request.filter_parameters', 'filter_parameters');87 $b->getContext()->getEventDispatcher()->connect('view.configure_format', 'configure_iphone_format');88 86 $b-> 89 87 setHttpHeader('User-Agent', 'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3')-> … … 116 114 } 117 115 } 116 117 function configure_format_foo(sfEvent $event) 118 { 119 if ('foo' != $event['format']) 120 { 121 return; 122 } 123 124 $event['response']->setHttpHeader('x-foo', 'true'); 125 $event->getSubject()->setExtension('.php'); 126 }

