Skip to content

Commit

Permalink
Add negatives tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenDeDauw committed Aug 26, 2019
1 parent 5a720c6 commit 601aed9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/Integration/Types/IntegerTypeTest.php
Expand Up @@ -12,7 +12,7 @@ public function testNonStringValue() {
$this->assertIntegerValidation( 42, 42 );
}

private function assertIntegerValidation( int $expected, $input, array $definitionExtras = [] ) {
private function assertIntegerValidation( $expected, $input, array $definitionExtras = [] ) {
$parameters = $this->process(
[
'amount' => array_merge(
Expand All @@ -35,4 +35,16 @@ public function testNonStringValueDefaultsWhenExceedingUpperBound() {
$this->assertIntegerValidation( 7, 42, [ 'upperbound' => 20, 'default' => 7 ] );
}

public function testNonStringDefault() {
$this->assertIntegerValidation( '7', 'NAN', [ 'default' => '7' ] );
}

public function testNoNegatives() {
$this->assertIntegerValidation( 7, -1, [ 'negatives' => false, 'default' => 7 ] );
}

public function testNegative() {
$this->assertIntegerValidation( -1, -1 );
}

}

0 comments on commit 601aed9

Please sign in to comment.