Fakerino\Test\FakeData\Generator\IntegerGeneratorTest::testGenerateWithLengthOption PHP Method

testGenerateWithLengthOption() public method

public testGenerateWithLengthOption ( $length, $type, $negative )
    public function testGenerateWithLengthOption($length, $type, $negative)
    {
        $map = array(array('length', $length), array('type', $type), array('negative', $negative));
        $this->mockCaller->expects($this->exactly(3))->method('getOption')->will($this->returnValueMap($map));
        $fakeInteger = $this->integerGenerator->generate();
        switch ($type) {
            case 'hex':
                $length += 2;
                break;
            case 'binary':
                $length += 2;
                break;
            case 'octal':
                $length += 1;
                break;
            case 'decimal':
                if ($negative) {
                    $length++;
                }
                break;
        }
        $this->assertEquals($length, strlen($fakeInteger), sprintf('the number %s %s length is not %s', $type, $fakeInteger, $length));
    }