Ethereum PHP
PHP interface to Ethereum JSON-RPC API.
TestEthContract Class Reference
+ Inheritance diagram for TestEthContract:
+ Collaboration diagram for TestEthContract:

Protected Attributes


Additional Inherited Members

- Static Public Member Functions inherited from TestEthClient
static setUpBeforeClass ()

Detailed Description

Abstract base class for Tests

Exclude by running only the static tests vendor/bin/phpunit --testsuite EthereumPhp

  • requires an available Ethereum Node running.
  • The test contracts must be deployed and the contract address set corresponding with the network id.
  • You want to use truffle to deploy the contracts and generate the metadata file test_contracts/build/contracts/SmartContractTest.json
  • valid Environment variables SERVER_URL and NETWORK_ID

Easiest way to get started is using

  • Ganache as a testserver
  • Truffle to deploy the contracts npm install -g truffle && cd test_contracts && truffle build && truffle migrate

Default is the Ganache default config. <env name="SERVER_URL" value=""/> <env name="NETWORK_ID" value="5777"/>

You may define this vars in your shell before running tests. NETWORK_ID='1' SERVER_URL='http://localhost:8545' export NETWORK_ID export SERVER_URL

NETWORK_ID is used to get the Contract Address from Truffle deployed contracts. See build/contracts *.json

"networks": { NETWORK_ID: { "events": {}, "links": {}, "address": "0x345ca3e014aaf5dca488057592ee47305d9b3e10" },

Definition at line 66 of file TestEthContract.php.

Member Data Documentation

◆ $contract


Definition at line 69 of file TestEthContract.php.

◆ $data


Definition at line 68 of file TestEthContract.php.

The documentation for this class was generated from the following file: