commit
d89e7d1884
@ -4,4 +4,4 @@ require('../vendor/autoload.php');
|
||||
|
||||
use Web3\Web3;
|
||||
|
||||
$web3 = new Web3('http://192.168.99.100:8545');
|
||||
$web3 = new Web3('http://192.168.99.100:8545/');
|
@ -21,13 +21,10 @@ class BooleanFormatter implements IFormatter
|
||||
* format
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return int
|
||||
* @return bool
|
||||
*/
|
||||
public static function format($value)
|
||||
{
|
||||
if (!is_bool($value)) {
|
||||
throw new InvalidArgumentException('The value to inputFormat function must be boolean.');
|
||||
}
|
||||
return (int) $value;
|
||||
return (bool) $value;
|
||||
}
|
||||
}
|
@ -36,12 +36,15 @@ class BooleanFormatterTest extends TestCase
|
||||
$formatter = $this->formatter;
|
||||
|
||||
$boolean = $formatter->format(true);
|
||||
$this->assertEquals($boolean, 1);
|
||||
$this->assertEquals($boolean, true);
|
||||
|
||||
$boolean = $formatter->format(1);
|
||||
$this->assertEquals($boolean, true);
|
||||
|
||||
$boolean = $formatter->format(false);
|
||||
$this->assertEquals($boolean, 0);
|
||||
$this->assertEquals($boolean, false);
|
||||
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$boolean = $formatter->format('boolean');
|
||||
$boolean = $formatter->format(0);
|
||||
$this->assertEquals($boolean, false);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user