TestCase.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace Test;
  3. use \PHPUnit\Framework\TestCase as BaseTestCase;
  4. use Web3\Web3;
  5. class TestCase extends BaseTestCase
  6. {
  7. /**
  8. * web3
  9. *
  10. * @var \Web3\Web3
  11. */
  12. protected $web3;
  13. /**
  14. * testRinkebyHost
  15. *
  16. * @var string
  17. */
  18. protected $testRinkebyHost = 'https://rinkeby.infura.io/vuethexplore';
  19. /**
  20. * testHost
  21. *
  22. * @var string
  23. */
  24. protected $testHost = 'http://localhost:8545';
  25. /**
  26. * coinbase
  27. *
  28. * @var string
  29. */
  30. protected $coinbase;
  31. /**
  32. * setUp
  33. *
  34. * @return void
  35. */
  36. public function setUp()
  37. {
  38. $web3 = new Web3($this->testHost);
  39. $this->web3 = $web3;
  40. $web3->eth->coinbase(function ($err, $coinbase) {
  41. if ($err !== null) {
  42. return $this->fail($err->getMessage());
  43. }
  44. $this->coinbase = $coinbase;
  45. });
  46. }
  47. /**
  48. * tearDown
  49. *
  50. * @return void
  51. */
  52. public function tearDown() {}
  53. }