Skip to content

Commit 16d2360

Browse files
Merge branch '7.2' into 7.3
* 7.2: switch to Composer 2 metadata [Validator] Add tests for `MacAddress` Fix `ContainerDebugCommandTest::testNoDumpedXML` doc: update UserInterface header comments Fix: Lack of recipient in case DSN does not have optional LIST_ID parameter. [PhpUnitBridge] Mark as dev package [DependencyInjection] Make `YamlDumper` quote resolved env vars if necessary Bump Symfony version to 7.2.8 Update VERSION for 7.2.7 Update CHANGELOG for 7.2.7 Bump Symfony version to 6.4.23 Update VERSION for 6.4.22 Update CONTRIBUTORS for 6.4.22 Update CHANGELOG for 6.4.22 fixed Via regex
2 parents dabb03c + 715fd0b commit 16d2360

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Tests/Constraints/MacAddressValidatorTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,19 @@ public function testValidMac($mac)
6363
$this->assertNoViolation();
6464
}
6565

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+
6679
public static function getValidMacs(): array
6780
{
6881
return [
@@ -76,6 +89,17 @@ public static function getValidMacs(): array
7689
];
7790
}
7891

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+
79103
public static function getValidLocalUnicastMacs(): array
80104
{
81105
return [

0 commit comments

Comments
 (0)