Skip to content
Permalink
Browse files

Updated php-bitcoinrpc to 2.x branch.

  • Loading branch information...
denpamusic committed Aug 17, 2017
1 parent 999a071 commit ff510aa9ff48157c7976e6bfee6aa7e776a4deda
Showing with 208 additions and 7 deletions.
  1. +17 −0 .codeclimate.yml
  2. +1 −1 .env.example
  3. +1 −0 .styleci.yml
  4. +31 −0 .travis.yml
  5. +1 −1 README.md
  6. +7 −3 composer.json
  7. +1 −1 config/config.php
  8. +29 −0 phpunit.xml.dist
  9. +1 −1 src/Providers/ServiceProvider.php
  10. +119 −0 tests/BitcoindTest.php
@@ -0,0 +1,17 @@
engines:
duplication:
enabled: true
config:
languages:
- php
fixme:
enabled: true
phpmd:
enabled: true

ratings:
paths:
- "**.php"

exclude_paths:
- tests/
@@ -2,4 +2,4 @@ BITCOIND_SCHEME=http
BITCOIND_HOST=127.0.0.1
BITCOIND_PORT=8332
BITCOIND_USER=rpcuser
BITCOIND_PASS=rpcpassword
BITCOIND_PASSWORD=rpcpassword
@@ -0,0 +1 @@
preset: laravel
@@ -0,0 +1,31 @@
language: php

dist: trusty

php:
- 5.6
- 7.0
- 7.1
- 7.2
- hhvm

before_script:
- composer self-update
- composer install --prefer-source --no-interaction --dev

script:
- mkdir -p build/logs
- php vendor/bin/phpunit

matrix:
allow_failures:
- php: hhvm
- php: 5.6
fast_finish: true

addons:
code_climate:
repo_token: 68ba46bd3a5cf4c8b5506d323f40ce3cb93038dd5963752f26eea63ca81038fc

after_success:
- vendor/bin/test-reporter
@@ -42,7 +42,7 @@ BITCOIND_PASS=(rpcpassword from bitcoin.conf)
```

## Requirements
* PHP 5.6 or higher
* PHP 7.0 or higher
* Laravel 5.1 or higher

## Usage
@@ -15,16 +15,20 @@
"require": {
"php": ">=5.6.0",
"illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*",
"denpa/php-bitcoinrpc": "^1.0"
"denpa/php-bitcoinrpc": "^2.0"
},
"require-dev": {
"phpunit/phpunit": "5.7.*",
"orchestra/testbench": "3.x"
"phpunit/phpunit": "6.3.*",
"orchestra/testbench": "3.x",
"codeclimate/php-test-reporter": "dev-master"
},
"autoload": {
"psr-4" : {
"Denpa\\Bitcoin\\": "src/"
},
"classmap" : [
"tests"
],
"files": [
"src/helpers.php"
]
@@ -65,7 +65,7 @@
|
*/
'pass' => env('BITCOIND_PASS', ''),
'password' => env('BITCOIND_PASSWORD', ''),
/*
|--------------------------------------------------------------------------
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
syntaxCheck="true"
verbose="true"
>
<testsuites>
<testsuite name="Laravel Bitcoin API Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>
@@ -63,7 +63,7 @@ protected function registerClient()
'host' => $app['config']->get('bitcoind.host', 'localhost'),
'port' => $app['config']->get('bitcoind.port', 8332),
'user' => $app['config']->get('bitcoind.user'),
'pass' => $app['config']->get('bitcoind.pass'),
'pass' => $app['config']->get('bitcoind.password'),
'ca' => $app['config']->get('bitcoind.ca')
]);
});
@@ -0,0 +1,119 @@
<?php
use Denpa\Bitcoin\Client as BitcoinClient;
use Denpa\Bitcoin\Traits\Bitcoind;
use GuzzleHttp\Psr7\Response;
use Orchestra\Testbench\TestCase;
class BitcoindTest extends TestCase
{
use Bitcoind;
/**
* Get package providers.
*
* @param \Illuminate\Foundation\Application $app
*
* @return array
*/
protected function getPackageProviders($app)
{
return [
\Denpa\Bitcoin\Providers\ServiceProvider::class,
];
}
/**
* Get package aliases.
*
* @param \Illuminate\Foundation\Application $app
*
* @return array
*/
protected function getPackageAliases($app)
{
return [
'Bitcoind' => 'Denpa\Bitcoin\Facades\Bitcoind',
];
}
/**
* Define environment setup.
*
* @param \Illuminate\Foundation\Application $app
* @return void
*/
protected function getEnvironmentSetUp($app)
{
$app['config']->set('bitcoind.user', 'testuser');
$app['config']->set('bitcoind.password', 'testpass');
}
/**
* Test service provider.
*
* @return void
*/
public function testServiceIsAvailable()
{
$this->assertTrue($this->app->bound('bitcoind'));
}
/**
* Test facade.
*
* @return void
*/
public function testFacade()
{
$this->assertInstanceOf(BitcoinClient::class, \Bitcoind::getFacadeRoot());
}
/**
* Test helper.
*
* @return void
*/
public function testHelper()
{
$this->assertInstanceOf(BitcoinClient::class, bitcoind());
}
/**
* Test trait.
*
* @return void
*/
public function testTrait()
{
$this->assertInstanceOf(BitcoinClient::class, $this->bitcoind());
}
/**
* Test bitcoin config.
*
* @return void
*/
public function testConfig()
{
$config = bitcoind()->getConfig();
$this->assertEquals(
config('bitcoind.scheme'),
$config['base_uri']->getScheme()
);
$this->assertEquals(
config('bitcoind.host'),
$config['base_uri']->getHost()
);
$this->assertEquals(
config('bitcoind.port'),
$config['base_uri']->getPort()
);
$this->assertEquals(config('bitcoind.user'), $config['auth'][0]);
$this->assertEquals(config('bitcoind.password'), $config['auth'][1]);
}
}

0 comments on commit ff510aa

Please sign in to comment.
You can’t perform that action at this time.