This repository has been archived by the owner on Jul 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from anetwork/develop
Added new validation more and less
- Loading branch information
Showing
4 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -280,4 +280,44 @@ public function Domain($attribute, $value) | |
|
||
} | ||
|
||
/** | ||
* value must be more than parameters | ||
* @param $attribute $value $parameters | ||
* @author Shahrokh Niakan <[email protected]> | ||
* @since Agu 24, 2016 | ||
* @return boolean | ||
*/ | ||
public function More($attribute, $value, $parameters) | ||
{ | ||
|
||
if ( isset( $parameters[0] ) ) { | ||
|
||
return ( $value > $parameters[0] ? true : false ); | ||
|
||
} | ||
|
||
return false; | ||
|
||
} | ||
|
||
/** | ||
* value must be less than parameters | ||
* @param $attribute $value $parameters | ||
* @author Shahrokh Niakan <[email protected]> | ||
* @since Agu 24, 2016 | ||
* @return boolean | ||
*/ | ||
public function Less($attribute, $value, $parameters) | ||
{ | ||
|
||
if ( isset( $parameters[0] ) ) { | ||
|
||
return ( $value < $parameters[0] ? true : false ); | ||
|
||
} | ||
|
||
return false; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -365,4 +365,54 @@ public function testDomain() | |
$this->assertEquals(false, $this->PersianValidation->Domain($this->attribute, $this->value)); | ||
|
||
} | ||
|
||
/** | ||
* unit test of more | ||
* @author Shahrokh Niakan <[email protected]> | ||
* @since Agu 24, 2016 | ||
* @return void | ||
*/ | ||
public function testMore() | ||
{ | ||
|
||
$this->value = 10; | ||
|
||
$this->parameters[0] = 9; | ||
|
||
$this->assertEquals(true, $this->PersianValidation->More($this->attribute, $this->value, $this->parameters)); | ||
|
||
$this->parameters[0] = 11; | ||
|
||
$this->assertEquals(false, $this->PersianValidation->More($this->attribute, $this->value, $this->parameters)); | ||
|
||
$this->parameters[0] = 10; | ||
|
||
$this->assertEquals(false, $this->PersianValidation->More($this->attribute, $this->value, $this->parameters)); | ||
|
||
} | ||
|
||
/** | ||
* unit test of less | ||
* @author Shahrokh Niakan <[email protected]> | ||
* @since Agu 24, 2016 | ||
* @return void | ||
*/ | ||
public function testLess() | ||
{ | ||
|
||
$this->value = 10; | ||
|
||
$this->parameters[0] = 11; | ||
|
||
$this->assertEquals(true, $this->PersianValidation->Less($this->attribute, $this->value, $this->parameters)); | ||
|
||
$this->parameters[0] = 9; | ||
|
||
$this->assertEquals(false, $this->PersianValidation->Less($this->attribute, $this->value, $this->parameters)); | ||
|
||
$this->parameters[0] = 10; | ||
|
||
$this->assertEquals(false, $this->PersianValidation->Less($this->attribute, $this->value, $this->parameters)); | ||
|
||
} | ||
} |