Skip to content
PawelPodkalicki edited this page Aug 1, 2018 · 7 revisions

Installation

We use SemVer for versioning. For the versions available, see the tags on this repository.

Several quick start options are available:

Usage

Initialize CliDriver (Command line Driver) with ADS blockchain credentials (account address, private key, node host and port).

$driver = new CliDriver($this->address, $this->secret, $this->host, $this->port);

Please, note that by default CliDriver uses ads as ADS blockchain client application and saves cache to ~/.ads directory. This behaviour can be overwritten with $driver->setCommand(string) and $driver->setWorkingDir(string) methods.

Initialize client with driver.

$client = new AdsClient($driver);

Call commands using created client. In current version client supports all block explorer commands and basic transaction.

Supported block explorer commands:

  • getAccount,
  • getAccounts,
  • getBlock,
  • getBlockIds,
  • getBroadcast,
  • getMe,
  • getMessage,
  • getMessageIds,
  • getTransaction.

Supported transactions:

  • broadcast,
  • sendMany,
  • sendOne.

Tests

Tests are split into three categories: end-to-end, unit and coding style.

End-to-end tests

Aim of end to end test is to check integration between PHP ADS Client and ADS blockchain network. Therefore working network must be set and ADS client must be installed in system. Tests are placed in tests/E2E directory and can be run with PHPUnit.

Unit tests

Unit tests are placed in tests/Unit directory and can be run with PHPUnit.

Coding style tests

PHP Code Sniffer is used to check compatiblity with PHP language and PSR-2 standard.

./vendor/bin/phpcs -s --standard=PHPCompatibility src tests
./vendor/bin/phpcs -s --standard=PSR2 src tests

PHP Code Beautifier and Fixer can be used for automatic fix of PSR-2 incompatibility.

./vendor/bin/phpcbf -s --standard=PSR2 src tests

PHPStan is used for static analysis.

./vendor/bin/phpstan --no-ansi --no-progress analyse -c phpstan.neon -l 7 src tests
Clone this wiki locally
You can’t perform that action at this time.