Changeset 6945
- Timestamp:
- 01/05/08 14:16:30 (9 months ago)
- Files:
-
- branches/1.1/lib/validator/sfValidatorSchemaForEach.class.php (modified) (1 diff)
- branches/1.1/test/unit/validator/sfValidatorBooleanTest.php (modified) (2 diffs)
- branches/1.1/test/unit/validator/sfValidatorCSRFTokenTest.php (modified) (2 diffs)
- branches/1.1/test/unit/validator/sfValidatorCallbackTest.php (modified) (2 diffs)
- branches/1.1/test/unit/validator/sfValidatorChoiceManyTest.php (modified) (3 diffs)
- branches/1.1/test/unit/validator/sfValidatorChoiceTest.php (modified) (2 diffs)
- branches/1.1/test/unit/validator/sfValidatorDateTest.php (modified) (6 diffs)
- branches/1.1/test/unit/validator/sfValidatorDecoratorTest.php (modified) (4 diffs)
- branches/1.1/test/unit/validator/sfValidatorEmailTest.php (modified) (2 diffs)
- branches/1.1/test/unit/validator/sfValidatorFileTest.php (modified) (3 diffs)
- branches/1.1/test/unit/validator/sfValidatorIntegerTest.php (modified) (5 diffs)
- branches/1.1/test/unit/validator/sfValidatorNumberTest.php (modified) (2 diffs)
- branches/1.1/test/unit/validator/sfValidatorRegexTest.php (modified) (2 diffs)
- branches/1.1/test/unit/validator/sfValidatorSchemaCompareTest.php (modified) (2 diffs)
- branches/1.1/test/unit/validator/sfValidatorSchemaFilterTest.php (modified) (3 diffs)
- branches/1.1/test/unit/validator/sfValidatorStringTest.php (modified) (3 diffs)
- branches/1.1/test/unit/validator/sfValidatorTest.php (modified) (2 diffs)
- branches/1.1/test/unit/validator/sfValidatorUrlTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/validator/sfValidatorSchemaForEach.class.php
r6196 r6945 10 10 11 11 /** 12 * 12 * sfValidatorSchemaForEach wraps a validator multiple times in a single validator. 13 13 * 14 14 * @package symfony branches/1.1/test/unit/validator/sfValidatorBooleanTest.php
r5816 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(1 6, new lime_output_color());13 $t = new lime_test(17, new lime_output_color()); 14 14 15 15 $v = new sfValidatorBoolean(); … … 39 39 $v->clean('astring'); 40 40 $t->fail('->clean() throws an error if the input value is not a true or a false value'); 41 $t->skip('', 1); 41 42 } 42 43 catch (sfValidatorError $e) 43 44 { 44 45 $t->pass('->clean() throws an error if the input value is not a true or a false value'); 46 $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError'); 45 47 } 46 48 branches/1.1/test/unit/validator/sfValidatorCSRFTokenTest.php
r6197 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 4, new lime_output_color());13 $t = new lime_test(5, new lime_output_color()); 14 14 15 15 // __construct() … … 35 35 $v->clean('another'); 36 36 $t->fail('->clean() throws an sfValidatorError if the token is not valid'); 37 $t->skip('', 1); 37 38 } 38 39 catch (sfValidatorError $e) 39 40 { 40 41 $t->pass('->clean() throws an sfValidatorError if the token is not valid'); 42 $t->is($e->getCode(), 'csrf_attack', '->clean() throws a sfValidatorError'); 41 43 } 42 44 branches/1.1/test/unit/validator/sfValidatorCallbackTest.php
r6197 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 5, new lime_output_color());13 $t = new lime_test(6, new lime_output_color()); 14 14 15 15 function clean_test($validator, $value) … … 43 43 { 44 44 $v->clean('bar'); 45 $t->fail('->clean() calls our validator callback'); 45 $t->fail('->clean() throws a sfValidatorError'); 46 $t->skip('', 1); 46 47 } 47 48 catch (sfValidatorError $e) 48 49 { 49 $t->pass('->clean() calls our validator callback'); 50 $t->pass('->clean() throws a sfValidatorError'); 51 $t->is($e->getCode(), 'must_be_foo', '->clean() throws a sfValidatorError'); 50 52 } 51 53 branches/1.1/test/unit/validator/sfValidatorChoiceManyTest.php
r5882 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 6, new lime_output_color());13 $t = new lime_test(8, new lime_output_color()); 14 14 15 15 $v = new sfValidatorChoiceMany(array('choices' => array('foo', 'bar'))); … … 25 25 $v->clean('foobar'); 26 26 $t->fail('->clean() throws an sfValidatorError if the value is not an expected value'); 27 $t->skip('', 1); 27 28 } 28 29 catch (sfValidatorError $e) 29 30 { 30 31 $t->pass('->clean() throws an sfValidatorError if the value is not an expected value'); 32 $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError'); 31 33 } 32 34 … … 35 37 $v->clean(array('foobar', 'bar')); 36 38 $t->fail('->clean() throws an sfValidatorError if the value is not an expected value'); 39 $t->skip('', 1); 37 40 } 38 41 catch (sfValidatorError $e) 39 42 { 40 43 $t->pass('->clean() throws an sfValidatorError if the value is not an expected value'); 44 $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError'); 41 45 } 42 46 branches/1.1/test/unit/validator/sfValidatorChoiceTest.php
r6197 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 6, new lime_output_color());13 $t = new lime_test(7, new lime_output_color()); 14 14 15 15 function choice_callable() … … 41 41 $v->clean('foobar'); 42 42 $t->fail('->clean() throws an sfValidatorError if the value is not an expected value'); 43 $t->skip('', 1); 43 44 } 44 45 catch (sfValidatorError $e) 45 46 { 46 47 $t->pass('->clean() throws an sfValidatorError if the value is not an expected value'); 48 $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError'); 47 49 } 48 50 branches/1.1/test/unit/validator/sfValidatorDateTest.php
r6875 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(2 6, new lime_output_color());13 $t = new lime_test(29, new lime_output_color()); 14 14 15 15 $v = new sfValidatorDate(); … … 30 30 $v->clean('This is not a date'); 31 31 $t->fail('->clean() throws a sfValidatorError if the date is a string and is not parsable by strtotime'); 32 $t->skip('', 1); 32 33 } 33 34 catch (sfValidatorError $e) 34 35 { 35 36 $t->pass('->clean() throws a sfValidatorError if the date is a string and is not parsable by strtotime'); 37 $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError'); 36 38 } 37 39 … … 53 55 { 54 56 $t->pass('->clean() throws a sfValidatorError if the date is not valid'); 57 $t->skip('', 1); 55 58 } 56 59 try … … 58 61 $v->clean(array('year' => -2, 'month' => 1, 'day' => 15)); 59 62 $t->fail('->clean() throws a sfValidatorError if the date is not valid'); 63 $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError'); 60 64 } 61 65 catch (sfValidatorError $e) … … 79 83 $t->pass('->clean() throws a sfValidatorError if the date does not match the regex'); 80 84 $t->like($e->getMessage(), '/'.preg_quote($v->getOption('date_format'), '/').'/', '->clean() returns the expected date format in the error message'); 85 $t->is($e->getCode(), 'bad_format', '->clean() throws a sfValidatorError'); 81 86 } 82 87 … … 106 111 $v->clean(array('year' => 2005, 'month' => 1, 'day' => 15, 'hour' => 12, 'minute' => '', 'second' => 12)); 107 112 $t->fail('->clean() throws a sfValidatorError if the time is not valid'); 113 $t->skip('', 1); 108 114 } 109 115 catch (sfValidatorError $e) branches/1.1/test/unit/validator/sfValidatorDecoratorTest.php
r6197 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 18, new lime_output_color());13 $t = new lime_test(20, new lime_output_color()); 14 14 15 15 class MyValidator extends sfValidatorDecorator … … 30 30 $v->clean(null); 31 31 $t->fail('->clean() throws a sfValidatorError if the value is required'); 32 $t->skip( );32 $t->skip('', 1); 33 33 } 34 34 catch (sfValidatorError $e) … … 82 82 $v->clean(null); 83 83 $t->fail('->clean() throws a sfValidatorError if the value is required'); 84 $t->skip('', 1); 84 85 } 85 86 catch (sfValidatorError $e) 86 87 { 87 88 $t->pass('->clean() throws a sfValidatorError if the value is required'); 89 $t->is($e->getCode(), 'required', '->clean() throws a sfValidatorError'); 88 90 } 89 91 … … 92 94 $v->clean('f'); 93 95 $t->fail('->clean() throws a sfValidatorError if the wrapped validator failed'); 96 $t->skip('', 1); 94 97 } 95 98 catch (sfValidatorError $e) 96 99 { 97 100 $t->pass('->clean() throws a sfValidatorError if the wrapped validator failed'); 101 $t->is($e->getCode(), 'min_length', '->clean() throws a sfValidatorError'); 98 102 } 99 103 branches/1.1/test/unit/validator/sfValidatorEmailTest.php
r5581 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 7, new lime_output_color());13 $t = new lime_test(11, new lime_output_color()); 14 14 15 15 $v = new sfValidatorEmail(); … … 37 37 $v->clean($nonUrl); 38 38 $t->fail('->clean() throws an sfValidatorError if the value is not a valid email'); 39 $t->skip('', 1); 39 40 } 40 41 catch (sfValidatorError $e) 41 42 { 42 43 $t->pass('->clean() throws an sfValidatorError if the value is not a valid email'); 44 $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError'); 43 45 } 44 46 } branches/1.1/test/unit/validator/sfValidatorFileTest.php
r6870 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(5 7, new lime_output_color());13 $t = new lime_test(58, new lime_output_color()); 14 14 15 15 $tmpDir = sfToolkit::getTmpDir(); … … 116 116 $v->clean(array('test' => true)); 117 117 $t->fail('->clean() throws an sfValidatorError if the given value is not well formatted'); 118 $t->skip('', 1); 118 119 } 119 120 catch (sfValidatorError $e) 120 121 { 121 122 $t->pass('->clean() throws an sfValidatorError if the given value is not well formatted'); 123 $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError'); 122 124 } 123 125 $f = $v->clean(array('tmp_name' => $tmpDir.'/test.txt')); … … 133 135 $v->clean(array('tmp_name' => $tmpDir.'/test.txt', 'error' => $error)); 134 136 $t->fail('->clean() throws an sfValidatorError if the error code is not UPLOAD_ERR_OK (0)'); 135 $t->skip( );137 $t->skip('', 1); 136 138 } 137 139 catch (sfValidatorError $e) branches/1.1/test/unit/validator/sfValidatorIntegerTest.php
r5816 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(1 1, new lime_output_color());13 $t = new lime_test(15, new lime_output_color()); 14 14 15 15 $v = new sfValidatorInteger(); … … 24 24 $v->clean('not an integer'); 25 25 $t->fail('->clean() throws a sfValidatorError if the value is not an integer'); 26 $t->skip('', 1); 26 27 } 27 28 catch (sfValidatorError $e) 28 29 { 29 30 $t->pass('->clean() throws a sfValidatorError if the value is not an integer'); 31 $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError'); 30 32 } 31 33 … … 34 36 $v->clean(12.3); 35 37 $t->fail('->clean() throws a sfValidatorError if the value is not an integer'); 38 $t->skip('', 1); 36 39 } 37 40 catch (sfValidatorError $e) 38 41 { 39 42 $t->pass('->clean() throws a sfValidatorError if the value is not an integer'); 43 $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError'); 40 44 } 41 45 … … 49 53 $v->clean(3); 50 54 $t->fail('"max" option set the maximum number allowed'); 55 $t->skip('', 1); 51 56 } 52 57 catch (sfValidatorError $e) 53 58 { 54 59 $t->pass('"max" option set the maximum number allowed'); 60 $t->is($e->getCode(), 'max', '->clean() throws a sfValidatorError'); 55 61 } 56 62 … … 74 80 $v->clean('1'); 75 81 $t->fail('"min" option set the minimum number allowed'); 82 $t->skip('', 1); 76 83 } 77 84 catch (sfValidatorError $e) 78 85 { 79 $t->pass('"min_length" option set the minimum number allowed'); 86 $t->pass('"min" option set the minimum number allowed'); 87 $t->is($e->getCode(), 'min', '->clean() throws a sfValidatorError'); 80 88 } 81 89 branches/1.1/test/unit/validator/sfValidatorNumberTest.php
r5816 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(1 0, new lime_output_color());13 $t = new lime_test(11, new lime_output_color()); 14 14 15 15 $v = new sfValidatorNumber(); … … 64 64 $v->clean('1'); 65 65 $t->fail('"min" option set the minimum number allowed'); 66 $t->skip('', 1); 66 67 } 67 68 catch (sfValidatorError $e) 68 69 { 69 $t->pass('"min_length" option set the minimum number allowed'); 70 $t->pass('"min" option set the minimum number allowed'); 71 $t->is($e->getCode(), 'min', '->clean() throws a sfValidatorError'); 70 72 } 71 73 branches/1.1/test/unit/validator/sfValidatorRegexTest.php
r6197 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 4, new lime_output_color());13 $t = new lime_test(5, new lime_output_color()); 14 14 15 15 // __construct() … … 35 35 $v->clean('symfony'); 36 36 $t->fail('->clean() throws an sfValidatorError if the value does not match the pattern'); 37 $t->skip('', 1); 37 38 } 38 39 catch (sfValidatorError $e) 39 40 { 40 41 $t->pass('->clean() throws an sfValidatorError if the value does not match the pattern'); 42 $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError'); 41 43 } 42 44 branches/1.1/test/unit/validator/sfValidatorSchemaCompareTest.php
r6197 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 19, new lime_output_color());13 $t = new lime_test(27, new lime_output_color()); 14 14 15 15 $v = new sfValidatorSchemaCompare('left', sfValidatorSchemaCompare::EQUAL, 'right'); … … 49 49 $v->clean($values[0]); 50 50 $t->fail('->clean() throws an sfValidatorError if the value is the comparison failed'); 51 $t->skip('', 1); 51 52 } 52 53 catch (sfValidatorError $e) 53 54 { 54 55 $t->pass('->clean() throws an sfValidatorError if the value is the comparison failed'); 56 $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError'); 55 57 } 56 58 } branches/1.1/test/unit/validator/sfValidatorSchemaFilterTest.php
r6197 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 4, new lime_output_color());13 $t = new lime_test(6, new lime_output_color()); 14 14 15 15 $v1 = new sfValidatorString(array('min_length' => 2, 'trim' => true)); … … 35 35 $v->clean(null); 36 36 $t->fail('->clean() throws a sfValidatorError if the embedded validator failed'); 37 $t->skip('', 1); 37 38 } 38 39 catch (sfValidatorError $e) 39 40 { 40 41 $t->pass('->clean() throws a sfValidatorError if the embedded validator failed'); 42 $t->is($e->getCode(), 'required', '->clean() throws a sfValidatorError'); 41 43 } 42 44 … … 45 47 $v->clean(array('first_name' => 'f')); 46 48 $t->fail('->clean() throws a sfValidatorError if the embedded validator failed'); 49 $t->skip('', 1); 47 50 } 48 51 catch (sfValidatorError $e) 49 52 { 50 53 $t->pass('->clean() throws a sfValidatorError if the embedded validator failed'); 54 $t->is($e->getCode(), 'min_length', '->clean() throws a sfValidatorError'); 51 55 } branches/1.1/test/unit/validator/sfValidatorStringTest.php
r5816 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(1 0, new lime_output_color());13 $t = new lime_test(12, new lime_output_color()); 14 14 15 15 $v = new sfValidatorString(); … … 29 29 $v->clean('foo'); 30 30 $t->fail('"max_length" option set the maximum length of the string'); 31 $t->skip('', 1); 31 32 } 32 33 catch (sfValidatorError $e) 33 34 { 34 35 $t->pass('"max_length" option set the maximum length of the string'); 36 $t->is($e->getCode(), 'max_length', '->clean() throws a sfValidatorError'); 35 37 } 36 38 … … 54 56 $v->clean('fo'); 55 57 $t->fail('"min_length" option set the minimum length of the string'); 58 $t->skip('', 1); 56 59 } 57 60 catch (sfValidatorError $e) 58 61 { 59 62 $t->pass('"min_length" option set the minimum length of the string'); 63 $t->is($e->getCode(), 'min_length', '->clean() throws a sfValidatorError'); 60 64 } 61 65 branches/1.1/test/unit/validator/sfValidatorTest.php
r6197 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(3 7, new lime_output_color());13 $t = new lime_test(38, new lime_output_color()); 14 14 15 15 class ValidatorIdentity extends sfValidator … … 99 99 $t->is($v->clean(''), ''); 100 100 $t->fail('->clean() throws a sfValidatorError exception if the data does not validate'); 101 $t->skip('', 1); 101 102 } 102 103 catch (sfValidatorError $e) 103 104 { 104 105 $t->pass('->clean() throws a sfValidatorError exception if the data does not validate'); 106 $t->is($e->getCode(), 'required', '->clean() throws a sfValidatorError'); 105 107 } 106 108 $t->is($v->clean(' foo '), ' foo ', '->clean() does not trim whitespaces by default'); branches/1.1/test/unit/validator/sfValidatorUrlTest.php
r5581 r6945 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 9, new lime_output_color());13 $t = new lime_test(12, new lime_output_color()); 14 14 15 15 $v = new sfValidatorUrl(); … … 39 39 $v->clean($nonUrl); 40 40 $t->fail('->clean() throws an sfValidatorError if the value is not a valid URL'); 41 $t->skip('', 1); 41 42 } 42 43 catch (sfValidatorError $e) 43 44 { 44 45 $t->pass('->clean() throws an sfValidatorError if the value is not a valid URL'); 46 $t->is($e->getCode(), 'invalid', '->clean() throws a sfValidatorError'); 45 47 } 46 48 }