Skip to content
This repository has been archived by the owner on Jul 10, 2021. It is now read-only.

Commit

Permalink
Changed phone validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahrokh Niakan committed Sep 27, 2016
1 parent 04f88ca commit 9e933b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/ValidationRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public function Less($attribute, $value, $parameters)
public function IranPhone($attribute, $value)
{

$this->status = preg_match('/^((0)([1-9]{2})([0-9]{8}))+$/', $value) ;
$this->status = preg_match('/^([1-9]{8})+$/', $value) ;

return ( $this->status ? true : false );

Expand Down
12 changes: 6 additions & 6 deletions tests/PersianValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct()
{

$this->PersianValidation = new ValidationRules();

}

/**
Expand Down Expand Up @@ -444,17 +444,17 @@ public function testLess()
public function testIranPhone()
{

$this->value = '08337236555';
$this->value = '7236445';

$this->assertEquals(true, $this->PersianValidation->IranPhone($this->attribute, $this->value));
$this->assertEquals(false, $this->PersianValidation->IranPhone($this->attribute, $this->value));

$this->value = '21372365544';
$this->value = '0217236445';

$this->assertEquals(false, $this->PersianValidation->IranPhone($this->attribute, $this->value));

$this->value = '021372365541';
$this->value = '37236445';

$this->assertEquals(false, $this->PersianValidation->IranPhone($this->attribute, $this->value));
$this->assertEquals(true, $this->PersianValidation->IranPhone($this->attribute, $this->value));

}
}

0 comments on commit 9e933b9

Please sign in to comment.