ShhBatchTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace Test\Unit;
  3. use RuntimeException;
  4. use Test\TestCase;
  5. class ShhBatchTest extends TestCase
  6. {
  7. /**
  8. * shh
  9. *
  10. * @var Web3\Shh
  11. */
  12. protected $shh;
  13. /**
  14. * setUp
  15. *
  16. * @return void
  17. */
  18. public function setUp()
  19. {
  20. parent::setUp();
  21. $this->shh = $this->web3->shh;
  22. }
  23. /**
  24. * testBatch
  25. *
  26. * @return void
  27. */
  28. public function testBatch()
  29. {
  30. $shh = $this->shh;
  31. $shh->batch(true);
  32. $shh->version();
  33. $shh->version();
  34. $shh->provider->execute(function ($err, $data) {
  35. if ($err !== null) {
  36. return $this->fail('Got error!');
  37. }
  38. $this->assertTrue(is_string($data[0]));
  39. $this->assertTrue(is_string($data[1]));
  40. });
  41. }
  42. /**
  43. * testWrongParam
  44. *
  45. * @return void
  46. */
  47. // public function testWrongParam()
  48. // {
  49. // $this->expectException(RuntimeException::class);
  50. // $shh = $this->shh;
  51. // $shh->batch(true);
  52. // $shh->version();
  53. // $shh->hasIdentity('0');
  54. // $shh->provider->execute(function ($err, $data) {
  55. // if ($err !== null) {
  56. // return $this->fail('Got error!');
  57. // }
  58. // $this->assertTrue(is_string($data[0]));
  59. // $this->assertFalse($data[1]);
  60. // });
  61. // }
  62. }