diff --git a/tests/Unit/Scalar/ImmutableFloatTest.php b/tests/Unit/Scalar/ImmutableFloatTest.php index a0d11d9..29a5fd8 100644 --- a/tests/Unit/Scalar/ImmutableFloatTest.php +++ b/tests/Unit/Scalar/ImmutableFloatTest.php @@ -7,7 +7,6 @@ use Hradigital\Datatypes\Scalar\ImmutableFloat; use Hradigital\Datatypes\Scalar\MutableFloat; use Hradigital\Tests\Datatypes\AbstractBaseTestCase; -use Hradigital\Datatypes\Scalar\ReadonlyBoolean; /** * Immutable Float Unit testing. @@ -123,43 +122,6 @@ public function testCanConvertInstanceToInteger(): void ); } - /** - * Tests that the instance can be converted to a Boolean. - * - * @since 1.0.0 - * @return void - */ - public function testCanConvertInstanceToBoolean(): void - { - // Performs test. - $true = $this->initializeInstance(123.0); - $false = $this->initializeInstance(0.0); - $trueBoolean = $true->toBoolean(); - $falseBoolean = $false->toBoolean(); - - // Performs assertions. - $this->assertInstanceOf( - ReadonlyBoolean::class, - $trueBoolean, - 'Instance type, does not match ReadonlyBoolean.' - ); - $this->assertEquals( - 'True', - $trueBoolean->toString(), - 'Instance value is not correct.' - ); - $this->assertInstanceOf( - ReadonlyBoolean::class, - $falseBoolean, - 'Instance type, does not match ReadonlyBoolean.' - ); - $this->assertEquals( - 'False', - $falseBoolean->toString(), - 'Instance value is not correct.' - ); - } - /** * Tests that the instance can be converted to a String. * diff --git a/tests/Unit/Scalar/ReadonlyFloatTest.php b/tests/Unit/Scalar/ReadonlyFloatTest.php index 11f7e66..225c078 100644 --- a/tests/Unit/Scalar/ReadonlyFloatTest.php +++ b/tests/Unit/Scalar/ReadonlyFloatTest.php @@ -6,6 +6,7 @@ use Hradigital\Datatypes\Scalar\ReadonlyInteger; use Hradigital\Datatypes\Scalar\ReadonlyString; use Hradigital\Tests\Datatypes\AbstractBaseTestCase; +use Hradigital\Datatypes\Scalar\ReadonlyBoolean; /** * Readonly Float Unit testing. @@ -468,4 +469,41 @@ public function testCanConvertToInteger(): void "Returned instance should have been of type ReadonlyInteger." ); } + + /** + * Tests that the instance can be converted to a Boolean. + * + * @since 1.0.0 + * @return void + */ + public function testCanConvertInstanceToBoolean(): void + { + // Performs test. + $true = ReadonlyFloat::fromFloat(123.0); + $false = ReadonlyFloat::fromFloat(0.0); + $trueBoolean = $true->toBoolean(); + $falseBoolean = $false->toBoolean(); + + // Performs assertions. + $this->assertInstanceOf( + ReadonlyBoolean::class, + $trueBoolean, + 'Instance type, does not match ReadonlyBoolean.' + ); + $this->assertEquals( + 'True', + $trueBoolean->toString(), + 'Instance value is not correct.' + ); + $this->assertInstanceOf( + ReadonlyBoolean::class, + $falseBoolean, + 'Instance type, does not match ReadonlyBoolean.' + ); + $this->assertEquals( + 'False', + $falseBoolean->toString(), + 'Instance value is not correct.' + ); + } } diff --git a/tests/Unit/Scalar/ReadonlyIntegerTest.php b/tests/Unit/Scalar/ReadonlyIntegerTest.php index 320953d..208da00 100644 --- a/tests/Unit/Scalar/ReadonlyIntegerTest.php +++ b/tests/Unit/Scalar/ReadonlyIntegerTest.php @@ -6,6 +6,7 @@ use Hradigital\Datatypes\Scalar\ReadonlyInteger; use Hradigital\Datatypes\Scalar\ReadonlyString; use Hradigital\Tests\Datatypes\AbstractBaseTestCase; +use Hradigital\Datatypes\Scalar\ReadonlyBoolean; /** * Readonly Integer Unit testing. @@ -466,4 +467,41 @@ public function testCanConvertToFloat(): void "Returned instance should have been of type ReadonlyFloat." ); } + + /** + * Tests that the instance can be converted to a Boolean. + * + * @since 1.0.0 + * @return void + */ + public function testCanConvertInstanceToBoolean(): void + { + // Performs test. + $true = ReadonlyInteger::fromInteger(123); + $false = ReadonlyInteger::fromInteger(0); + $trueBoolean = $true->toBoolean(); + $falseBoolean = $false->toBoolean(); + + // Performs assertions. + $this->assertInstanceOf( + ReadonlyBoolean::class, + $trueBoolean, + 'Instance type, does not match ReadonlyBoolean.' + ); + $this->assertEquals( + 'True', + $trueBoolean->toString(), + 'Instance value is not correct.' + ); + $this->assertInstanceOf( + ReadonlyBoolean::class, + $falseBoolean, + 'Instance type, does not match ReadonlyBoolean.' + ); + $this->assertEquals( + 'False', + $falseBoolean->toString(), + 'Instance value is not correct.' + ); + } }