From a616b5752114c49e53db603166fab412bb1fe1fb Mon Sep 17 00:00:00 2001 From: Marcel Naeve Date: Sat, 14 May 2016 21:33:32 +0200 Subject: [PATCH] added some more phpunit tests. --- ValidateTest.php | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/ValidateTest.php b/ValidateTest.php index 8191617..497b509 100644 --- a/ValidateTest.php +++ b/ValidateTest.php @@ -288,4 +288,68 @@ class ValidateTest extends PHPUnit_Framework_TestCase $this->assertFalse( Validate::ip("@") ); } + /* + * Validate::mac(); Tests + */ + public function testMac_random_valid11() + { + $this->assertTrue( Validate::mac("ce:bb:ac:22:9e:72") ); + } + public function testMac_random_valid12() + { + $this->assertTrue( Validate::mac("ce-bb-ac-22-9e-72") ); + } + public function testMac_random_valid13() + { + $this->assertTrue( Validate::mac("cebb.ac22.9e72") ); + } + public function testMac_random_valid21() + { + $this->assertTrue( Validate::mac("77:a8:7a:bf:45:6f") ); + } + public function testMac_random_valid22() + { + $this->assertTrue( Validate::mac("77-a8-7a-bf-45-6f") ); + } + public function testMac_random_valid23() + { + $this->assertTrue( Validate::mac("77a8.7abf.456f") ); + } + public function testMac_invalid1() + { + $this->assertFalse( Validate::mac("58-E4-C8-C3-5G-23") ); + } + public function testMac_invalid2() + { + $this->assertFalse( Validate::mac("58-E4-C8-C3-5-23") ); + } + public function testMac_invalid3() + { + $this->assertFalse( Validate::mac("58-E4-C8-C3-23") ); + } + public function testMac_invalid4() + { + $this->assertFalse( Validate::mac("58-E4-C8-23") ); + } + public function testMac_empty() + { + $this->assertFalse( Validate::mac("") ); + } + public function testMac_trash1() + { + $this->assertFalse( Validate::mac("%") ); + } + public function testMac_trash2() + { + $this->assertFalse( Validate::mac("-") ); + } + public function testMac_trash3() + { + $this->assertFalse( Validate::mac(".") ); + } + public function testMac_trash4() + { + $this->assertFalse( Validate::mac(":") ); + } + }