Code coverage plus first unit test
This commit is contained in:
parent
c42276c856
commit
de6242913b
@ -1,5 +1,5 @@
|
|||||||
[](https://travis-ci.org/delboy1978uk/php-mpos) [](https://scrutinizer-ci.com/g/delboy1978uk/php-mpos/?branch=master) [](https://scrutinizer-ci.com/g/delboy1978uk/php-mpos/?branch=master) master<br />
|
[](https://travis-ci.org/MPOS/php-mpos) [](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) [](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) master<br />
|
||||||
[](https://travis-ci.org/delboy1978uk/php-mpos) [](https://scrutinizer-ci.com/g/delboy1978uk/php-mpos/?branch=development) [](https://scrutinizer-ci.com/g/delboy1978uk/php-mpos/?branch=development) development
|
[](https://travis-ci.org/MPOS/php-mpos) [](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=development) [](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=development) development
|
||||||
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
|||||||
@ -15,3 +15,7 @@ modules:
|
|||||||
user: ''
|
user: ''
|
||||||
password: ''
|
password: ''
|
||||||
dump: tests/_data/dump.sql
|
dump: tests/_data/dump.sql
|
||||||
|
coverage:
|
||||||
|
whitelist:
|
||||||
|
include:
|
||||||
|
- include/classes/*
|
||||||
|
|||||||
@ -1,2 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
// This is global bootstrap for autoloading
|
// This is global bootstrap for autoloading
|
||||||
|
|
||||||
|
// Set a decently long SECURITY key with special chars etc
|
||||||
|
define('SECURITY', '*)WT#&YHfd');
|
||||||
|
// Whether or not to check SECHASH for validity, still checks if SECURITY defined as before if disabled
|
||||||
|
define('SECHASH_CHECK', false);
|
||||||
|
|
||||||
|
// change SECHASH every second, we allow up to 3 sec back for slow servers
|
||||||
|
if (SECHASH_CHECK) {
|
||||||
|
function fip($tr=0) { return md5(SECURITY.(time()-$tr).SECURITY); }
|
||||||
|
define('SECHASH', fip());
|
||||||
|
function cfip() { return (fip()==SECHASH||fip(1)==SECHASH||fip(2)==SECHASH) ? 1 : 0; }
|
||||||
|
} else {
|
||||||
|
function cfip() { return (@defined('SECURITY')) ? 1 : 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define("BASEPATH", dirname(__FILE__) . "/");
|
||||||
|
|
||||||
|
define('INCLUDE_DIR', BASEPATH . '../include');
|
||||||
|
define('CLASS_DIR', INCLUDE_DIR . '/classes');
|
||||||
|
define('PAGES_DIR', INCLUDE_DIR . '/pages');
|
||||||
|
define('TEMPLATE_DIR', BASEPATH . '../templates');
|
||||||
23
tests/unit/BitcoinTest.php
Normal file
23
tests/unit/BitcoinTest.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once(CLASS_DIR . '/bitcoin.class.php');
|
||||||
|
|
||||||
|
class BitcoinTest extends \Codeception\TestCase\Test
|
||||||
|
{
|
||||||
|
|
||||||
|
public function _before()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function _after()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAddressToHash160()
|
||||||
|
{
|
||||||
|
$bitcoin = new Bitcoin();
|
||||||
|
$this->assertEquals('82839EADFB204C8D22ED122A0868C6F52B5BDFC9',$bitcoin->addressToHash160('1Cu6X3c716CCKU3Bi2jfHv8kZ2QCor8uXm'));
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user