Extension\CastTest::testIntCast PHP Method

testIntCast() public method

public testIntCast ( )
    public function testIntCast()
    {
        $t = new Cast();
        /**
         * Value
         */
        $this->assertSame(5, $t->testIntCastFromFloat());
        $this->assertSame(1, $t->testIntCastFromBooleanTrue());
        $this->assertSame(0, $t->testIntCastFromBooleanFalse());
        $this->assertSame(0, $t->testIntCastFromNull());
        $this->assertSame(0, $t->testIntCastFromStringValue());
        $this->assertSame(0, $t->testIntCastFromEmptyArray());
        $this->assertSame(1, $t->testIntCastFromArray());
        $this->assertSame(1, $t->testIntCastFromStdClass());
        /**
         * Variable types
         */
        $this->assertSame(5, $t->testIntCastFromVariableFloat());
        $this->assertSame(1, $t->testIntCastFromVariableBooleanTrue());
        $this->assertSame(0, $t->testIntCastFromVariableBooleanFalse());
        $this->assertSame(0, $t->testIntCastFromVariableNull());
        $this->assertSame(0, $t->testIntCastFromVariableString());
        $this->assertSame((int) "test", $t->testIntCastFromParameterString("test"));
        $this->assertSame((int) "1", $t->testIntCastFromParameterString("1"));
        $this->assertSame((int) "12345", $t->testIntCastFromParameterString("12345"));
        $this->assertSame((int) "-1", $t->testIntCastFromParameterString("-1"));
        $this->assertSame((int) "+5", $t->testIntCastFromParameterString("+5"));
        $this->assertSame(0, $t->testIntCastFromVariableEmptyArray());
        $this->assertSame(1, $t->testIntCastFromVariableArray());
        $this->assertSame(1, $t->testIntCastFromVariableStdClass());
    }