TestCase.php 983 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. public function setUp(): void
  35. {
  36. $web3 = new Web3($this->testHost);
  37. $this->web3 = $web3;
  38. $web3->eth->coinbase(function ($err, $coinbase) {
  39. if ($err !== null) {
  40. return $this->fail($err->getMessage());
  41. }
  42. $this->coinbase = $coinbase;
  43. });
  44. }
  45. /**
  46. * tearDown
  47. */
  48. public function tearDown(): void {}
  49. }