示例#1
0
 /**
  * @param mixed $nullOrValue
  */
 protected function setValue($nullOrValue)
 {
     if (is_null($nullOrValue)) {
         $this->value = $nullOrValue;
     } else {
         parent::setValue($nullOrValue);
     }
 }
示例#2
0
    public function testFloatProperty()
    {
        $min = 1.0;
        $max = 100.00;
        $validFloat = 5.0;
        $toLarge = 100.1;
        $toSmall = 0.1;
        $property = new Float('AProperty', null, $min, $max);

        $property->setValue($validFloat);
        $this->assertEquals($validFloat, $property->getValue());

        $property->setValue($toLarge);
        $this->assertEquals($max, $property->getValue());

        $property->setValue($toSmall);
        $this->assertEquals($min, $property->getValue());
    }