Permalink
Browse files

Code coverage plus first unit test

  • Loading branch information...
scuts committed Dec 22, 2014
1 parent c42276c commit de6242913b53f2a819715458d19f53504b49c8c6
Showing with 51 additions and 2 deletions.
  1. +2 −2 README.md
  2. +4 −0 codeception.yml
  3. +22 −0 tests/_bootstrap.php
  4. +23 −0 tests/unit/BitcoinTest.php
View
@@ -1,5 +1,5 @@
[![Build Status](https://travis-ci.org/delboy1978uk/php-mpos.png?branch=master)](https://travis-ci.org/delboy1978uk/php-mpos) [![Code Coverage](https://scrutinizer-ci.com/g/delboy1978uk/php-mpos/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/delboy1978uk/php-mpos/?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/delboy1978uk/php-mpos/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/delboy1978uk/php-mpos/?branch=master) master<br />
[![Build Status](https://travis-ci.org/delboy1978uk/php-mpos.png?branch=development)](https://travis-ci.org/delboy1978uk/php-mpos) [![Code Coverage](https://scrutinizer-ci.com/g/delboy1978uk/php-mpos/badges/coverage.png?b=development)](https://scrutinizer-ci.com/g/delboy1978uk/php-mpos/?branch=development) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/delboy1978uk/php-mpos/badges/quality-score.png?b=development)](https://scrutinizer-ci.com/g/delboy1978uk/php-mpos/?branch=development) development
[![Build Status](https://travis-ci.org/MPOS/php-mpos.png?branch=master)](https://travis-ci.org/MPOS/php-mpos) [![Code Coverage](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=master) master<br />
[![Build Status](https://travis-ci.org/MPOS/php-mpos.png?branch=development)](https://travis-ci.org/MPOS/php-mpos) [![Code Coverage](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/coverage.png?b=development)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=development) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/MPOS/php-mpos/badges/quality-score.png?b=development)](https://scrutinizer-ci.com/g/MPOS/php-mpos/?branch=development) development
Description
View
@@ -15,3 +15,7 @@ modules:
user: ''
password: ''
dump: tests/_data/dump.sql
coverage:
whitelist:
include:
- include/classes/*
View
@@ -1,2 +1,24 @@
<?php
// 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');
View
@@ -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'));
}
}

0 comments on commit de62429

Please sign in to comment.