Development

Changeset 4404

You must first sign up to be able to contribute.

Changeset 4404

Show
Ignore:
Timestamp:
06/26/07 14:26:33 (1 year ago)
Author:
fabien
Message:

fixed sfTestBrowser::isResponseHeader() method (closes #1900)

Files:

Legend:

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

    r3329 r4404  
    233233  public function isResponseHeader($key, $value) 
    234234  { 
    235     $headers = $this->getResponse()->getHttpHeader($key); 
     235    $headers = explode(', ', $this->getResponse()->getHttpHeader($key)); 
    236236 
    237237    $ok = false; 
     238 
    238239    foreach ($headers as $header) 
    239240    { 
     
    245246    } 
    246247 
    247     $this->test->ok($ok, sprintf('response header "%s" is "%s"', $key, $value)); 
     248    $this->test->ok($ok, sprintf('response header "%s" is "%s" (%s)', $key, $value, $this->getResponse()->getHttpHeader($key))); 
    248249 
    249250    return $this; 
  • branches/1.0/test/functional/fixtures/project/apps/frontend/modules/browser/actions/actions.class.php

    r4293 r4404  
    1919  { 
    2020    $this->getResponse()->setContentType('text/plain'); 
     21 
    2122    return $this->renderText('text'); 
    2223  } 
     24 
     25  public function executeResponseHeader() 
     26  { 
     27    $response = $this->getResponse(); 
     28 
     29    $response->setContentType('text/plain'); 
     30    $response->setHttpHeader('foo', 'bar', true); 
     31    $response->setHttpHeader('foo', 'foobar', false); 
     32 
     33    return $this->renderText('ok'); 
     34  } 
    2335} 
  • branches/1.0/test/functional/sfTestBrowserTest.php

    r4286 r4404  
    6161  $b->test()->pass('The DOM is not accessible if the response content type is not HTML'); 
    6262} 
     63 
     64// check response headers 
     65$b-> 
     66  get('/browser/responseHeader')-> 
     67  isStatusCode()-> 
     68  isResponseHeader('content-type', 'text/plain; charset=utf-8')-> 
     69  isResponseHeader('foo', 'bar')-> 
     70  isResponseHeader('foo', 'foobar') 
     71;