/** * @test */ public function I_can_use_to_string_object() { $boolean = new Boolean(new TestWithToString($integerZero = 0)); self::assertSame((bool) $integerZero, $boolean->getValue()); $boolean = new Boolean(new TestWithToString($integer = 12345)); self::assertSame((bool) $integer, $boolean->getValue()); $stringBoolean = new Boolean(new TestWithToString($stringInteger = '98765')); self::assertSame((bool) $stringInteger, $stringBoolean->getValue()); $floatBoolean = new Boolean(new TestWithToString($float = 123.456)); self::assertSame((bool) $float, $floatBoolean->getValue()); $stringFloatBoolean = new Boolean(new TestWithToString($stringFloat = '987.654')); self::assertSame((bool) $stringFloat, $stringFloatBoolean->getValue()); $stringFloatBoolean = new Boolean(new TestWithToString($emptyString = '')); self::assertSame((bool) $emptyString, $stringFloatBoolean->getValue()); $stringFloatBoolean = new Boolean(new TestWithToString($someString = 'foo')); self::assertSame((bool) $someString, $stringFloatBoolean->getValue()); }
protected function getRootNamespace() { $rootReflection = new \ReflectionClass(Boolean::getClass()); return $rootReflection->getNamespaceName(); }