File tree Expand file tree Collapse file tree 14 files changed +86
-86
lines changed
src/Symfony/Component/Validator/Tests/Constraints Expand file tree Collapse file tree 14 files changed +86
-86
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ public function testUnknownModesTriggerException()
45
45
46
46
public function testNormalizerCanBeSet ()
47
47
{
48
- $ email = new Email (array ( 'normalizer ' => 'trim ' ) );
48
+ $ email = new Email ([ 'normalizer ' => 'trim ' ] );
49
49
50
50
$ this ->assertEquals ('trim ' , $ email ->normalizer );
51
51
}
@@ -56,7 +56,7 @@ public function testNormalizerCanBeSet()
56
56
*/
57
57
public function testInvalidNormalizerThrowsException ()
58
58
{
59
- new Email (array ( 'normalizer ' => 'Unknown Callable ' ) );
59
+ new Email ([ 'normalizer ' => 'Unknown Callable ' ] );
60
60
}
61
61
62
62
/**
@@ -65,6 +65,6 @@ public function testInvalidNormalizerThrowsException()
65
65
*/
66
66
public function testInvalidNormalizerObjectThrowsException ()
67
67
{
68
- new Email (array ( 'normalizer ' => new \stdClass ()) );
68
+ new Email ([ 'normalizer ' => new \stdClass ()] );
69
69
}
70
70
}
Original file line number Diff line number Diff line change @@ -99,21 +99,21 @@ public function getValidEmails()
99
99
*/
100
100
public function testValidNormalizedEmails ($ email )
101
101
{
102
- $ this ->validator ->validate ($ email , new Email (array ( 'normalizer ' => 'trim ' ) ));
102
+ $ this ->validator ->validate ($ email , new Email ([ 'normalizer ' => 'trim ' ] ));
103
103
104
104
$ this ->assertNoViolation ();
105
105
}
106
106
107
107
public function getValidEmailsWithWhitespaces ()
108
108
{
109
- return array (
110
- array ( "\x20example@example.co.uk \x20" ) ,
111
- array ( "\x09\x09example@example.co..uk \x09\x09" ) ,
112
- array ( "\x0A{}~!@!@£$%%^&*().!@£$%^&*() \x0A" ) ,
113
- array ( "\x0D\x0Dexample@example.co..uk \x0D\x0D" ) ,
114
- array ( "\x00example@-example.com " ) ,
115
- array ( "example@example.com \x0B\x0B" ) ,
116
- ) ;
109
+ return [
110
+ [ "\x20example@example.co.uk \x20" ] ,
111
+ [ "\x09\x09example@example.co..uk \x09\x09" ] ,
112
+ [ "\x0A{}~!@!@£$%%^&*().!@£$%^&*() \x0A" ] ,
113
+ [ "\x0D\x0Dexample@example.co..uk \x0D\x0D" ] ,
114
+ [ "\x00example@-example.com " ] ,
115
+ [ "example@example.com \x0B\x0B" ] ,
116
+ ] ;
117
117
}
118
118
119
119
/**
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ class IpTest extends TestCase
21
21
{
22
22
public function testNormalizerCanBeSet ()
23
23
{
24
- $ ip = new Ip (array ( 'normalizer ' => 'trim ' ) );
24
+ $ ip = new Ip ([ 'normalizer ' => 'trim ' ] );
25
25
26
26
$ this ->assertEquals ('trim ' , $ ip ->normalizer );
27
27
}
@@ -32,7 +32,7 @@ public function testNormalizerCanBeSet()
32
32
*/
33
33
public function testInvalidNormalizerThrowsException ()
34
34
{
35
- new Ip (array ( 'normalizer ' => 'Unknown Callable ' ) );
35
+ new Ip ([ 'normalizer ' => 'Unknown Callable ' ] );
36
36
}
37
37
38
38
/**
@@ -41,6 +41,6 @@ public function testInvalidNormalizerThrowsException()
41
41
*/
42
42
public function testInvalidNormalizerObjectThrowsException ()
43
43
{
44
- new Ip (array ( 'normalizer ' => new \stdClass ()) );
44
+ new Ip ([ 'normalizer ' => new \stdClass ()] );
45
45
}
46
46
}
Original file line number Diff line number Diff line change @@ -85,24 +85,24 @@ public function getValidIpsV4()
85
85
*/
86
86
public function testValidIpsV4WithWhitespaces ($ ip )
87
87
{
88
- $ this ->validator ->validate ($ ip , new Ip (array (
88
+ $ this ->validator ->validate ($ ip , new Ip ([
89
89
'version ' => Ip::V4 ,
90
90
'normalizer ' => 'trim ' ,
91
- ) ));
91
+ ] ));
92
92
93
93
$ this ->assertNoViolation ();
94
94
}
95
95
96
96
public function getValidIpsV4WithWhitespaces ()
97
97
{
98
- return array (
99
- array ( "\x200.0.0.0 " ) ,
100
- array ( "\x09\x0910.0.0.0 " ) ,
101
- array ( "123.45.67.178 \x0A" ) ,
102
- array ( "172.16.0.0 \x0D\x0D" ) ,
103
- array ( "\x00192.168.1.0 \x00" ) ,
104
- array ( "\x0B\x0B224.0.0.1 \x0B\x0B" ) ,
105
- ) ;
98
+ return [
99
+ [ "\x200.0.0.0 " ] ,
100
+ [ "\x09\x0910.0.0.0 " ] ,
101
+ [ "123.45.67.178 \x0A" ] ,
102
+ [ "172.16.0.0 \x0D\x0D" ] ,
103
+ [ "\x00192.168.1.0 \x00" ] ,
104
+ [ "\x0B\x0B224.0.0.1 \x0B\x0B" ] ,
105
+ ] ;
106
106
}
107
107
108
108
/**
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ class LengthTest extends TestCase
21
21
{
22
22
public function testNormalizerCanBeSet ()
23
23
{
24
- $ length = new Length (array ( 'min ' => 0 , 'max ' => 10 , 'normalizer ' => 'trim ' ) );
24
+ $ length = new Length ([ 'min ' => 0 , 'max ' => 10 , 'normalizer ' => 'trim ' ] );
25
25
26
26
$ this ->assertEquals ('trim ' , $ length ->normalizer );
27
27
}
@@ -32,7 +32,7 @@ public function testNormalizerCanBeSet()
32
32
*/
33
33
public function testInvalidNormalizerThrowsException ()
34
34
{
35
- new Length (array ( 'min ' => 0 , 'max ' => 10 , 'normalizer ' => 'Unknown Callable ' ) );
35
+ new Length ([ 'min ' => 0 , 'max ' => 10 , 'normalizer ' => 'Unknown Callable ' ] );
36
36
}
37
37
38
38
/**
@@ -41,6 +41,6 @@ public function testInvalidNormalizerThrowsException()
41
41
*/
42
42
public function testInvalidNormalizerObjectThrowsException ()
43
43
{
44
- new Length (array ( 'min ' => 0 , 'max ' => 10 , 'normalizer ' => new \stdClass ()) );
44
+ new Length ([ 'min ' => 0 , 'max ' => 10 , 'normalizer ' => new \stdClass ()] );
45
45
}
46
46
}
Original file line number Diff line number Diff line change @@ -94,14 +94,14 @@ public function getOneCharset()
94
94
95
95
public function getThreeCharactersWithWhitespaces ()
96
96
{
97
- return array (
98
- array ( "\x20ccc " ) ,
99
- array ( "\x09c \x09c " ) ,
100
- array ( "\x0Accc \x0A" ) ,
101
- array ( "ccc \x0D\x0D" ) ,
102
- array ( "\x00ccc \x00" ) ,
103
- array ( "\x0Bc \x0Bc \x0B" ) ,
104
- ) ;
97
+ return [
98
+ [ "\x20ccc " ] ,
99
+ [ "\x09c \x09c " ] ,
100
+ [ "\x0Accc \x0A" ] ,
101
+ [ "ccc \x0D\x0D" ] ,
102
+ [ "\x00ccc \x00" ] ,
103
+ [ "\x0Bc \x0Bc \x0B" ] ,
104
+ ] ;
105
105
}
106
106
107
107
/**
@@ -142,7 +142,7 @@ public function testValidValuesExact($value)
142
142
*/
143
143
public function testValidNormalizedValues ($ value )
144
144
{
145
- $ constraint = new Length (array ( 'min ' => 3 , 'max ' => 3 , 'normalizer ' => 'trim ' ) );
145
+ $ constraint = new Length ([ 'min ' => 3 , 'max ' => 3 , 'normalizer ' => 'trim ' ] );
146
146
$ this ->validator ->validate ($ value , $ constraint );
147
147
148
148
$ this ->assertNoViolation ();
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ class NotBlankTest extends TestCase
21
21
{
22
22
public function testNormalizerCanBeSet ()
23
23
{
24
- $ notBlank = new NotBlank (array ( 'normalizer ' => 'trim ' ) );
24
+ $ notBlank = new NotBlank ([ 'normalizer ' => 'trim ' ] );
25
25
26
26
$ this ->assertEquals ('trim ' , $ notBlank ->normalizer );
27
27
}
@@ -32,7 +32,7 @@ public function testNormalizerCanBeSet()
32
32
*/
33
33
public function testInvalidNormalizerThrowsException ()
34
34
{
35
- new NotBlank (array ( 'normalizer ' => 'Unknown Callable ' ) );
35
+ new NotBlank ([ 'normalizer ' => 'Unknown Callable ' ] );
36
36
}
37
37
38
38
/**
@@ -41,6 +41,6 @@ public function testInvalidNormalizerThrowsException()
41
41
*/
42
42
public function testInvalidNormalizerObjectThrowsException ()
43
43
{
44
- new NotBlank (array ( 'normalizer ' => new \stdClass ()) );
44
+ new NotBlank ([ 'normalizer ' => new \stdClass ()] );
45
45
}
46
46
}
Original file line number Diff line number Diff line change @@ -130,10 +130,10 @@ public function testAllowNullFalse()
130
130
*/
131
131
public function testNormalizedStringIsInvalid ($ value )
132
132
{
133
- $ constraint = new NotBlank (array (
133
+ $ constraint = new NotBlank ([
134
134
'message ' => 'myMessage ' ,
135
135
'normalizer ' => 'trim ' ,
136
- ) );
136
+ ] );
137
137
138
138
$ this ->validator ->validate ($ value , $ constraint );
139
139
@@ -145,13 +145,13 @@ public function testNormalizedStringIsInvalid($value)
145
145
146
146
public function getWhitespaces ()
147
147
{
148
- return array (
149
- array ( "\x20" ) ,
150
- array ( "\x09\x09" ) ,
151
- array ( "\x0A" ) ,
152
- array ( "\x0D\x0D" ) ,
153
- array ( "\x00" ) ,
154
- array ( "\x0B\x0B" ) ,
155
- ) ;
148
+ return [
149
+ [ "\x20" ] ,
150
+ [ "\x09\x09" ] ,
151
+ [ "\x0A" ] ,
152
+ [ "\x0D\x0D" ] ,
153
+ [ "\x00" ] ,
154
+ [ "\x0B\x0B" ] ,
155
+ ] ;
156
156
}
157
157
}
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ public function testGetCustomHtmlPattern()
88
88
89
89
public function testNormalizerCanBeSet ()
90
90
{
91
- $ regex = new Regex (array ( 'pattern ' => '/^[0-9]+$/ ' , 'normalizer ' => 'trim ' ) );
91
+ $ regex = new Regex ([ 'pattern ' => '/^[0-9]+$/ ' , 'normalizer ' => 'trim ' ] );
92
92
93
93
$ this ->assertEquals ('trim ' , $ regex ->normalizer );
94
94
}
@@ -99,7 +99,7 @@ public function testNormalizerCanBeSet()
99
99
*/
100
100
public function testInvalidNormalizerThrowsException ()
101
101
{
102
- new Regex (array ( 'pattern ' => '/^[0-9]+$/ ' , 'normalizer ' => 'Unknown Callable ' ) );
102
+ new Regex ([ 'pattern ' => '/^[0-9]+$/ ' , 'normalizer ' => 'Unknown Callable ' ] );
103
103
}
104
104
105
105
/**
@@ -108,6 +108,6 @@ public function testInvalidNormalizerThrowsException()
108
108
*/
109
109
public function testInvalidNormalizerObjectThrowsException ()
110
110
{
111
- new Regex (array ( 'pattern ' => '/^[0-9]+$/ ' , 'normalizer ' => new \stdClass ()) );
111
+ new Regex ([ 'pattern ' => '/^[0-9]+$/ ' , 'normalizer ' => new \stdClass ()] );
112
112
}
113
113
}
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ public function testValidValues($value)
60
60
*/
61
61
public function testValidValuesWithWhitespaces ($ value )
62
62
{
63
- $ constraint = new Regex (array ( 'pattern ' => '/^[0-9]+$/ ' , 'normalizer ' => 'trim ' ) );
63
+ $ constraint = new Regex ([ 'pattern ' => '/^[0-9]+$/ ' , 'normalizer ' => 'trim ' ] );
64
64
$ this ->validator ->validate ($ value , $ constraint );
65
65
66
66
$ this ->assertNoViolation ();
@@ -84,14 +84,14 @@ public function __toString()
84
84
85
85
public function getValidValuesWithWhitespaces ()
86
86
{
87
- return array (
88
- array ( "\x207 " ) ,
89
- array ( "\x09\x09070707 \x09\x09" ) ,
90
- array ( "70707 \x0A" ) ,
91
- array ( "7 \x0D\x0D" ) ,
92
- array ( "\x00070707 \x00" ) ,
93
- array ( "\x0B\x0B70707 \x0B\x0B" ) ,
94
- ) ;
87
+ return [
88
+ [ "\x207 " ] ,
89
+ [ "\x09\x09070707 \x09\x09" ] ,
90
+ [ "70707 \x0A" ] ,
91
+ [ "7 \x0D\x0D" ] ,
92
+ [ "\x00070707 \x00" ] ,
93
+ [ "\x0B\x0B70707 \x0B\x0B" ] ,
94
+ ] ;
95
95
}
96
96
97
97
/**
You can’t perform that action at this time.
0 commit comments