Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/GreaterThanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,32 @@ public function testEqualsMessageVariables()
$this->assertAttributeEquals($validator->getOption('messageVariables'),
'messageVariables', $validator);
}

public function testCorrectInclusiveMessageReturn()
{
$valuesToValidate = array(0, 0.5, 5, 10);

foreach ($valuesToValidate as $value) {
$validator = new GreaterThan(10);
$validator->isValid($value);
$message = $validator->getMessages();

$this->assertArrayHaskey('notGreaterThan', $message);
$this->assertEquals($message['notGreaterThan'], "The input is not greater than '10'");
}
}

public function testCorrectNotInclusiveMessageReturn()
{
$valuesToValidate = array(0, 0.5, 5, 9);

foreach ($valuesToValidate as $value) {
$validator = new GreaterThan(array('min' => 10, 'inclusive' => true));
$validator->isValid($value);
$message = $validator->getMessages();

$this->assertArrayHaskey('notGreaterThanInclusive', $message);
$this->assertEquals($message['notGreaterThanInclusive'], "The input is not greater or equal than '10'");
}
}
}

0 comments on commit cf0a732

Please sign in to comment.