Skip to content

Commit

Permalink
Merge pull request #14 from williancarminato/master
Browse files Browse the repository at this point in the history
Fix IntNode::hasDefault
  • Loading branch information
klaussilveira authored Nov 24, 2016
2 parents 24d352b + e71fa4a commit 44eb9dd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Node/IntNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ public function __construct()
{
$this->addConstraint(new Type('int'));
}

public function hasDefault(): bool
{
return is_int($this->default);
}
}
14 changes: 14 additions & 0 deletions tests/Node/IntNodeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Linio\Component\Input\Node;

class IntNodeTest extends \PHPUnit_Framework_TestCase
{
public function testIsReturningTrueForDefaultValueZero()
{
$node = new IntNode();
$node->setDefault(0);

$this->assertTrue($node->hasDefault());
}
}

0 comments on commit 44eb9dd

Please sign in to comment.