/**
  * @return string
  */
 protected function getRootNamespace()
 {
     $rootClassReflection = new \ReflectionClass(FloatObject::getClass());
     return $rootClassReflection->getNamespaceName();
 }
Пример #2
0
 /**
  * @test
  * @expectedException \Granam\Float\Tools\Exceptions\ValueLostOnCast
  * @dataProvider provideStrictness
  * @param bool $strict
  */
 public function I_can_force_exception_in_case_of_rounding($strict)
 {
     try {
         $floatObject = new FloatObject($floatValue = '123456.999', $strict, true);
         self::assertSame((double) $floatValue, $floatObject->getValue());
     } catch (\Exception $exception) {
         self::fail('Unexpected any exception here: ' . $exception->getMessage());
     }
     new FloatObject('123456.999999999999999999999999999999999999', $strict, true);
     self::fail('Rounding has not been detected');
 }
Пример #3
0
 /**
  * @test
  */
 public function I_can_use_it_same_way_as_using_number_object()
 {
     $this->I_can_use_it_same_way_as_using('toFloat', FloatObject::getClass());
     $this->I_can_use_it_same_way_as_using('toPositiveFloat', PositiveFloatObject::getClass());
     $this->I_can_use_it_same_way_as_using('toNegativeFloat', NegativeFloatObject::getClass());
 }