Development

Changeset 8462

You must first sign up to be able to contribute.

Changeset 8462

Show
Ignore:
Timestamp:
04/15/08 01:29:36 (1 year ago)
Author:
fabien
Message:

added isUSerCulture() and isRequestFormat() method to sfTestBrowser

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/test/sfTestBrowser.class.php

    r8454 r8462  
    247247 
    248248    $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)); 
    249277 
    250278    return $this; 
  • branches/1.1/test/functional/formatTest.php

    r8461 r8462  
    2222  isRequestParameter('module', 'format')-> 
    2323  isRequestParameter('action', 'index')-> 
     24  isRequestFormat('js')-> 
    2425  isResponseHeader('content-type', 'application/javascript') 
    2526; 
     
    3334  isRequestParameter('module', 'format')-> 
    3435  isRequestParameter('action', 'index')-> 
     36  isRequestFormat('css')-> 
    3537  isResponseHeader('content-type', 'text/css; charset=utf-8') 
    3638; 
     
    4244  isRequestParameter('module', 'format')-> 
    4345  isRequestParameter('action', 'index')-> 
     46  isRequestFormat('html')-> 
    4447  isResponseHeader('content-type', 'text/html; charset=utf-8')-> 
    4548  checkResponseElement('body #content', 'This is an HTML file') 
     
    5154  isRequestParameter('module', 'format')-> 
    5255  isRequestParameter('action', 'index')-> 
     56  isRequestFormat('xml')-> 
    5357  isResponseHeader('content-type', 'text/xml; charset=utf-8')-> 
    5458  checkResponseElement('sentences sentence:first', 'This is a XML file') 
     
    6064  isRequestParameter('module', 'format')-> 
    6165  isRequestParameter('action', 'index')-> 
     66  isRequestFormat('foo')-> 
    6267  isResponseHeader('content-type', 'text/html; charset=utf-8')-> 
    6368  isResponseHeader('x-foo', 'true')-> 
     
    7176  isRequestParameter('module', 'format')-> 
    7277  isRequestParameter('action', 'jsWithAccept')-> 
     78  isRequestFormat('js')-> 
    7379  isResponseHeader('content-type', 'application/javascript') 
    7480; 
     
    8086  isRequestParameter('module', 'format')-> 
    8187  isRequestParameter('action', 'js')-> 
     88  isRequestFormat('js')-> 
    8289  isResponseHeader('content-type', 'application/javascript') 
    8390; 
     
    9097  isRequestParameter('module', 'format')-> 
    9198  isRequestParameter('action', 'forTheIPhone')-> 
     99  isRequestFormat('iphone')-> 
    92100  isResponseHeader('content-type', 'text/html; charset=utf-8')-> 
    93101  checkResponseElement('#content', 'This is an HTML file for the iPhone')-> 
  • branches/1.1/test/functional/i18nFormTest.php

    r8408 r8462  
    1515} 
    1616 
    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(); 
    2718 
    2819// default culture (en) 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.