Skip to content

Commit

Permalink
Add test for iranian company id
Browse files Browse the repository at this point in the history
  • Loading branch information
sadegh19b committed Mar 15, 2024
1 parent 6d74353 commit 0ea3e59
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/PersianValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

0 comments on commit 0ea3e59

Please sign in to comment.