web3.php/test/unit/BooleanFormatterTest.php
2022-02-26 02:43:32 -03:00

50 lines
963 B
PHP

<?php
namespace Test\Unit;
use InvalidArgumentException;
use Test\TestCase;
use Web3\Formatters\BooleanFormatter;
class BooleanFormatterTest extends TestCase
{
/**
* formatter
*
* @var \Web3\Formatters\BooleanFormatter
*/
protected $formatter;
/**
* setUp
*
* @return void
*/
public function setUp(): void
{
parent::setUp();
$this->formatter = new BooleanFormatter;
}
/**
* testFormat
*
* @return void
*/
public function testFormat()
{
$formatter = $this->formatter;
$boolean = $formatter->format(true);
$this->assertEquals($boolean, true);
$boolean = $formatter->format(1);
$this->assertEquals($boolean, true);
$boolean = $formatter->format(false);
$this->assertEquals($boolean, false);
$boolean = $formatter->format(0);
$this->assertEquals($boolean, false);
}
}