Changeset 2964

Show
Ignore:
Timestamp:
09/30/08 08:37:06 (7 weeks ago)
Author:
felix
Message:

added tests that check if the proper cookies are set when the 'remember' parameter is set to true

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/felix-testing-implementation/samples/test/tests/fragment/LoginSuccessViewTest.php

    r2962 r2964  
    1919  public function testResponseRedirect() 
    2020  { 
    21     $this->setArguments($this->createRequestDataHolder(array(AgaviWebRequestDataHolder::SOURCE_PARAMETERS => array('username' => 'foo', 'password' => 'bar')))); 
     21    $this->setArguments($this->createRequestDataHolder(array(AgaviWebRequestDataHolder::SOURCE_PARAMETERS => array('username' => 'Chuck Norris', 'password' => 'kick')))); 
    2222    $this->getContext()->getUser()->setAttribute('redirect', 'http://www.example.com/', 'org.agavi.SampleApp.login'); 
    2323    $this->runView(); 
     
    2828  public function testResponseHtml() 
    2929  { 
    30     $this->setArguments($this->createRequestDataHolder(array(AgaviWebRequestDataHolder::SOURCE_PARAMETERS => array('username' => 'foo', 'password' => 'bar')))); 
     30    $this->setArguments($this->createRequestDataHolder(array(AgaviWebRequestDataHolder::SOURCE_PARAMETERS => array('username' => 'Chuck Norris', 'password' => 'kick')))); 
    3131    $this->runView(); 
    3232    $this->assertResponseHasHTTPStatus(200); 
     
    3737    $this->assertContainerAttributeExists('title'); 
    3838  } 
     39   
     40  public function testResponseHasCookiesWhenRememberSet() 
     41  { 
     42    $this->setArguments($this->createRequestDataHolder(array(AgaviWebRequestDataHolder::SOURCE_PARAMETERS => array('username' => 'Chuck Norris', 'password' => 'kick', 'remember' => true)))); 
     43    $this->runView(); 
     44    $this->assertResponseHasHTTPStatus(200); 
     45    $this->assertViewResultEquals(''); 
     46    $this->assertHasLayer('content'); 
     47    $this->assertHasLayer('decorator'); 
     48    $this->assertResponseHasNoRedirect(); 
     49    $this->assertContainerAttributeExists('title'); 
     50    $this->assertResponseHasCookie('autologon[username]', array('value' => 'Chuck Norris', 'lifetime' => '1209600', 'path' => null, 'domain' => null, 'secure' => null, 'httponly' => null)); 
     51    $this->assertResponseHasCookie('autologon[password]', array('value' => 'd436130cf2f5024cfdb3aa7325322d530336b95f', 'lifetime' => '1209600', 'path' => null, 'domain' => null, 'secure' => null, 'httponly' => null)); 
     52  } 
     53   
    3954} 
    4055