BigNumberFormatterTest.php 781 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Test\Unit;
  3. use Test\TestCase;
  4. use phpseclib\Math\BigInteger as BigNumber;
  5. use Web3\Formatters\BigNumberFormatter;
  6. class BigNumberFormatterTest extends TestCase
  7. {
  8. /**
  9. * formatter
  10. *
  11. * @var \Web3\Formatters\BigNumberFormatter
  12. */
  13. protected $formatter;
  14. /**
  15. * setUp
  16. *
  17. * @return void
  18. */
  19. public function setUp()
  20. {
  21. parent::setUp();
  22. $this->formatter = new BigNumberFormatter;
  23. }
  24. /**
  25. * testFormat
  26. *
  27. * @return void
  28. */
  29. public function testFormat()
  30. {
  31. $formatter = $this->formatter;
  32. $bigNumber = $formatter->format(1);
  33. $this->assertEquals($bigNumber->toString(), '1');
  34. $this->assertTrue($bigNumber instanceof BigNumber);
  35. }
  36. }