Example #1
0
 public function testToReal()
 {
     $integer = new Integer(5);
     $nativeReal = new Real(5);
     $real = $integer->toReal();
     $this->assertTrue($real->sameValueAs($nativeReal));
 }
Example #2
0
 /**
  * Returns a Natural object given a PHP native int as parameter.
  *
  * @param int $value
  */
 public function __construct($value)
 {
     $options = array('options' => array('min_range' => 0));
     $value = filter_var($value, FILTER_VALIDATE_INT, $options);
     if (false === $value) {
         throw new InvalidNativeArgumentException($value, array('int (>=0)'));
     }
     parent::__construct($value);
 }