File tree 1 file changed +24
-0
lines changed
src/Symfony/Component/Validator/Tests/Constraints 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,19 @@ public function testValidMac($mac)
63
63
$ this ->assertNoViolation ();
64
64
}
65
65
66
+ /**
67
+ * @dataProvider getNotValidMacs
68
+ */
69
+ public function testNotValidMac ($ mac )
70
+ {
71
+ $ this ->validator ->validate ($ mac , new MacAddress ());
72
+
73
+ $ this ->buildViolation ('This value is not a valid MAC address. ' )
74
+ ->setParameter ('{{ value }} ' , '" ' .$ mac .'" ' )
75
+ ->setCode (MacAddress::INVALID_MAC_ERROR )
76
+ ->assertRaised ();
77
+ }
78
+
66
79
public static function getValidMacs (): array
67
80
{
68
81
return [
@@ -76,6 +89,17 @@ public static function getValidMacs(): array
76
89
];
77
90
}
78
91
92
+ public static function getNotValidMacs (): array
93
+ {
94
+ return [
95
+ ['00:00:00:00:00 ' ],
96
+ ['00:00:00:00:00:0G ' ],
97
+ ['GG:GG:GG:GG:GG:GG ' ],
98
+ ['GG-GG-GG-GG-GG-GG ' ],
99
+ ['GGGG.GGGG.GGGG ' ],
100
+ ];
101
+ }
102
+
79
103
public static function getValidLocalUnicastMacs (): array
80
104
{
81
105
return [
You can’t perform that action at this time.
0 commit comments