Development

Changeset 3502

You must first sign up to be able to contribute.

Changeset 3502

Show
Ignore:
Timestamp:
02/18/07 19:28:28 (2 years ago)
Author:
fabien
Message:

fixed isFirstCall() method in sfFilter class (closes #1446)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/lib/controller/sfFrontWebController.class.php

    r3204 r3502  
    3737      } 
    3838 
     39      // reinitialize filters (needed for unit and functional tests) 
     40      sfFilter::$filterCalled = array(); 
     41 
    3942      // determine our module and action 
    4043      $request    = $this->getContext()->getRequest(); 
  • branches/1.0/lib/filter/sfCacheFilter.class.php

    r3244 r3502  
    5252  { 
    5353    // execute this filter only once, if cache is set and no GET or POST parameters 
    54     if (!$this->isFirstCall() || !sfConfig::get('sf_cache') || count($_GET) || count($_POST)) 
     54    if (!sfConfig::get('sf_cache') || count($_GET) || count($_POST)) 
    5555    { 
    5656      $filterChain->execute(); 
  • branches/1.0/lib/filter/sfFilter.class.php

    r3244 r3502  
    2323  protected 
    2424    $parameterHolder = null, 
    25     $filterCalled    = array(), 
    2625    $context         = null; 
     26 
     27  public static 
     28    $filterCalled    = array(); 
    2729 
    2830  /** 
     
    3436  { 
    3537    $class = get_class($this); 
    36     if (isset($this->filterCalled[$class])) 
     38    if (isset(self::$filterCalled[$class])) 
    3739    { 
    3840      return false; 
     
    4042    else 
    4143    { 
    42       $this->filterCalled[$class] = true; 
     44      self::$filterCalled[$class] = true; 
    4345 
    4446      return true; 
  • branches/1.0/test/unit/filter/sfFilterTest.php

    r2276 r3502  
    1212require_once($_test_dir.'/unit/sfContextMock.class.php'); 
    1313 
    14 $t = new lime_test(19, new lime_output_color()); 
     14$t = new lime_test(20, new lime_output_color()); 
    1515 
    1616class myFilter extends sfFilter 
    1717{ 
    18   public function isFirstCallBeforeExecution() 
     18  public function isFirstCall() 
    1919  { 
    20     return parent::isFirstCallBeforeExecution(); 
    21   } 
    22  
    23   public function isFirstCallBeforeRendering() 
    24   { 
    25     return parent::isFirstCallBeforeRendering(); 
    26   } 
    27  
    28   public function isFirstCall($type = 'beforeExecution') 
    29   { 
    30     return parent::isFirstCall($type); 
     20    return parent::isFirstCall(); 
    3121  } 
    3222} 
     
    5343$t->is($filter->isFirstCall('beforeExecution'), false, '->isFirstCall() returns false if this is not the first call with this argument'); 
    5444 
     45$filter = new myFilter(); 
     46$filter->initialize($context); 
     47$t->is($filter->isFirstCall('beforeExecution'), false, '->isFirstCall() returns false if this is not the first call with this argument'); 
     48 
    5549// parameter holder proxy 
    5650require_once($_test_dir.'/unit/sfParameterHolderTest.class.php');