Changeset 8462
- Timestamp:
- 04/15/08 01:29:36 (1 year ago)
- Files:
-
- branches/1.1/lib/test/sfTestBrowser.class.php (modified) (1 diff)
- branches/1.1/test/functional/formatTest.php (modified) (8 diffs)
- branches/1.1/test/functional/i18nFormTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/test/sfTestBrowser.class.php
r8454 r8462 247 247 248 248 $this->test->ok($ok, sprintf('response header "%s" is "%s" (%s)', $key, $value, $this->getResponse()->getHttpHeader($key))); 249 250 return $this; 251 } 252 253 /** 254 * Tests for the user culture. 255 * 256 * @param string The user culture 257 * 258 * @return sfTestBrowser The current sfTestBrowser instance 259 */ 260 public function isUserCulture($culture) 261 { 262 $this->test->is($this->getContext()->getUser()->getCulture(), $culture, sprintf('user culture is "%s"', $culture)); 263 264 return $this; 265 } 266 267 /** 268 * Tests for the request is in the given format. 269 * 270 * @param string The user culture 271 * 272 * @return sfTestBrowser The current sfTestBrowser instance 273 */ 274 public function isRequestFormat($format) 275 { 276 $this->test->is($this->getContext()->getRequest()->getRequestFormat(), $format, sprintf('request format is "%s"', $format)); 249 277 250 278 return $this; branches/1.1/test/functional/formatTest.php
r8461 r8462 22 22 isRequestParameter('module', 'format')-> 23 23 isRequestParameter('action', 'index')-> 24 isRequestFormat('js')-> 24 25 isResponseHeader('content-type', 'application/javascript') 25 26 ; … … 33 34 isRequestParameter('module', 'format')-> 34 35 isRequestParameter('action', 'index')-> 36 isRequestFormat('css')-> 35 37 isResponseHeader('content-type', 'text/css; charset=utf-8') 36 38 ; … … 42 44 isRequestParameter('module', 'format')-> 43 45 isRequestParameter('action', 'index')-> 46 isRequestFormat('html')-> 44 47 isResponseHeader('content-type', 'text/html; charset=utf-8')-> 45 48 checkResponseElement('body #content', 'This is an HTML file') … … 51 54 isRequestParameter('module', 'format')-> 52 55 isRequestParameter('action', 'index')-> 56 isRequestFormat('xml')-> 53 57 isResponseHeader('content-type', 'text/xml; charset=utf-8')-> 54 58 checkResponseElement('sentences sentence:first', 'This is a XML file') … … 60 64 isRequestParameter('module', 'format')-> 61 65 isRequestParameter('action', 'index')-> 66 isRequestFormat('foo')-> 62 67 isResponseHeader('content-type', 'text/html; charset=utf-8')-> 63 68 isResponseHeader('x-foo', 'true')-> … … 71 76 isRequestParameter('module', 'format')-> 72 77 isRequestParameter('action', 'jsWithAccept')-> 78 isRequestFormat('js')-> 73 79 isResponseHeader('content-type', 'application/javascript') 74 80 ; … … 80 86 isRequestParameter('module', 'format')-> 81 87 isRequestParameter('action', 'js')-> 88 isRequestFormat('js')-> 82 89 isResponseHeader('content-type', 'application/javascript') 83 90 ; … … 90 97 isRequestParameter('module', 'format')-> 91 98 isRequestParameter('action', 'forTheIPhone')-> 99 isRequestFormat('iphone')-> 92 100 isResponseHeader('content-type', 'text/html; charset=utf-8')-> 93 101 checkResponseElement('#content', 'This is an HTML file for the iPhone')-> branches/1.1/test/functional/i18nFormTest.php
r8408 r8462 15 15 } 16 16 17 class myTestBrowser extends sfTestBrowser 18 { 19 public function isUserCulture($culture) 20 { 21 $this->test->is($this->getContext()->getUser()->getCulture(), $culture, sprintf('user culture is "%s"', $culture)); 22 return $this; 23 } 24 } 25 26 $b = new myTestBrowser(); 17 $b = new sfTestBrowser(); 27 18 28 19 // default culture (en)

