From 0ea3e59acb4a84845f349d7286ca11b120c31f59 Mon Sep 17 00:00:00 2001 From: Sadegh Barzegar Date: Sat, 16 Mar 2024 03:11:37 +0330 Subject: [PATCH] Add test for iranian company id --- tests/PersianValidationTest.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/PersianValidationTest.php b/tests/PersianValidationTest.php index c729daf..95af556 100644 --- a/tests/PersianValidationTest.php +++ b/tests/PersianValidationTest.php @@ -462,4 +462,30 @@ public function testIranPostalCode() $this->value = "11619735744"; $this->assertEquals(false, $this->persianValidator->validateIranianPostalCode($this->attribute, $this->value, $this->parameters)); } + + /** + * Unit test for Iranian company ID validation. + * + * @return void + */ + public function testIranCompanyID() + { + // Valid Iranian company ID + $this->assertTrue($this->persianValidator->validateIranianCompanyId($this->attribute, "14007650912", $this->parameters)); + + // Invalid Iranian company ID: incorrect length + $this->assertFalse($this->persianValidator->validateIranianCompanyId($this->attribute, "1234567890", $this->parameters)); + + // Invalid Iranian company ID: contains non-numeric characters + $this->assertFalse($this->persianValidator->validateIranianCompanyId($this->attribute, "1400765091a", $this->parameters)); + + // Invalid Iranian company ID: repetitive numbers + $this->assertFalse($this->persianValidator->validateIranianCompanyId($this->attribute, "11111111111", $this->parameters)); + + // Invalid Iranian company ID: checksum mismatch + $this->assertFalse($this->persianValidator->validateIranianCompanyId($this->attribute, "14007650911", $this->parameters)); + + // Invalid Iranian company ID: unexpected decimal number + $this->assertFalse($this->persianValidator->validateIranianCompanyId($this->attribute, "1400765091X", $this->parameters)); + } }