Changeset 33251
- Timestamp:
- 12/12/11 17:30:59 (1 year ago)
- Files:
-
- branches/1.4/lib/i18n/sfChoiceFormat.class.php (modified) (1 diff)
- branches/1.4/test/unit/i18n/sfChoiceFormatTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.4/lib/i18n/sfChoiceFormat.class.php
r23810 r33251 66 66 * The pattern to parse the formatting string. 67 67 */ 68 protected $parse = '/ \s*\|?([\(\[\{]([-Inf\d:\s]+,?[\+Inf\d\s:\?\-=!><%\|&\(\)]*)+[\)\]\}])\s*/';68 protected $parse = '/(?:^\s*|\s*\|)([\(\[\{]([-Inf\d:\s]+,?[\+Inf\d\s:\?\-=!><%\|&\(\)]*)+[\)\]\}])\s*/'; 69 69 70 70 /** branches/1.4/test/unit/i18n/sfChoiceFormatTest.php
r19531 r33251 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 89);13 $t = new lime_test(90); 14 14 15 15 $n = new sfChoiceFormat(); … … 98 98 $t->is($n->format($strings[4][0], 12), $strings[4][1][1][2], '->format() returns the string that match the number'); 99 99 100 // test strings with some set notation 101 $t->is($n->format("[0]Some text|[1,Inf] Some text (10)", 12), 'Some text (10)', '->format() does not take into account ranges that are not prefixed with |'); 102 100 103 // test set notation 101 104 // tests adapted from Prado unit test suite