Development

Changeset 29990

You must first sign up to be able to contribute.

Changeset 29990

Show
Ignore:
Timestamp:
06/25/10 19:06:20 (2 years ago)
Author:
Kris.Wallsmith
Message:

[1.3, 1.4] added sfOutputEscaperObjectDecorator::__isset() (closes #8793)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.3/lib/escaper/sfOutputEscaperObjectDecorator.class.php

    r29818 r29990  
    100100 
    101101  /** 
     102   * Asks the wrapped object whether a property is set. 
     103   * 
     104   * @return boolean 
     105   */ 
     106  public function __isset($key) 
     107  { 
     108    return isset($this->value->$key); 
     109  } 
     110 
     111  /** 
    102112   * Returns the size of the object if it implements Countable (is required by the Countable interface). 
    103113   * 
  • branches/1.3/test/unit/escaper/sfOutputEscaperObjectDecoratorTest.php

    r29818 r29990  
    2525sfConfig::set('sf_charset', 'UTF-8'); 
    2626 
    27 $t = new lime_test(6); 
     27$t = new lime_test(8); 
    2828 
    2929class OutputEscaperTest 
     
    8787$t->is(count($foo), 1, '->count() returns 1 if the embedded object does not implement the Countable interface'); 
    8888$t->is(count($fooc), 2, '->count() returns the count() for the embedded object'); 
     89 
     90// ->__isset() 
     91$t->diag('->__isset()'); 
     92 
     93$raw = new stdClass(); 
     94$raw->foo = 'bar'; 
     95$esc = sfOutputEscaper::escape('esc_entities', $raw); 
     96$t->ok(isset($esc->foo), '->__isset() asks the wrapped object whether a property is set'); 
     97unset($raw->foo); 
     98$t->ok(!isset($esc->foo), '->__isset() asks the wrapped object whether a property is set'); 
  • branches/1.4/lib/escaper/sfOutputEscaperObjectDecorator.class.php

    r29818 r29990  
    100100 
    101101  /** 
     102   * Asks the wrapped object whether a property is set. 
     103   * 
     104   * @return boolean 
     105   */ 
     106  public function __isset($key) 
     107  { 
     108    return isset($this->value->$key); 
     109  } 
     110 
     111  /** 
    102112   * Returns the size of the object if it implements Countable (is required by the Countable interface). 
    103113   * 
  • branches/1.4/test/unit/escaper/sfOutputEscaperObjectDecoratorTest.php

    r29818 r29990  
    2525sfConfig::set('sf_charset', 'UTF-8'); 
    2626 
    27 $t = new lime_test(6); 
     27$t = new lime_test(8); 
    2828 
    2929class OutputEscaperTest 
     
    8787$t->is(count($foo), 1, '->count() returns 1 if the embedded object does not implement the Countable interface'); 
    8888$t->is(count($fooc), 2, '->count() returns the count() for the embedded object'); 
     89 
     90// ->__isset() 
     91$t->diag('->__isset()'); 
     92 
     93$raw = new stdClass(); 
     94$raw->foo = 'bar'; 
     95$esc = sfOutputEscaper::escape('esc_entities', $raw); 
     96$t->ok(isset($esc->foo), '->__isset() asks the wrapped object whether a property is set'); 
     97unset($raw->foo); 
     98$t->ok(!isset($esc->foo), '->__isset() asks the wrapped object whether a property is set');