EthBatchTest.php 892 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace Test\Unit;
  3. use RuntimeException;
  4. use Test\TestCase;
  5. use phpseclib\Math\BigInteger as BigNumber;
  6. class EthBatchTest extends TestCase
  7. {
  8. /**
  9. * eth
  10. *
  11. * @var \Web3\Eth
  12. */
  13. protected $eth;
  14. /**
  15. * setUp
  16. *
  17. * @return void
  18. */
  19. public function setUp()
  20. {
  21. parent::setUp();
  22. $this->eth = $this->web3->eth;
  23. }
  24. /**
  25. * testBatch
  26. *
  27. * @return void
  28. */
  29. public function testBatch()
  30. {
  31. $eth = $this->eth;
  32. $eth->batch(true);
  33. $eth->protocolVersion();
  34. $eth->syncing();
  35. $eth->provider->execute(function ($err, $data) {
  36. if ($err !== null) {
  37. return $this->fail('Got error!');
  38. }
  39. $this->assertTrue($data[0] instanceof BigNumber);
  40. $this->assertTrue($data[1] !== null);
  41. });
  42. }
  43. }