Skip to content

Commit de62429

Browse files
committed
Code coverage plus first unit test
1 parent c42276c commit de62429

File tree

4 files changed

+51
-2
lines changed

4 files changed

+51
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[![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 />
2-
[![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
1+
[![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 />
2+
[![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
33

44

55
Description

codeception.yml

+4
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ modules:
1515
user: ''
1616
password: ''
1717
dump: tests/_data/dump.sql
18+
coverage:
19+
whitelist:
20+
include:
21+
- include/classes/*

tests/_bootstrap.php

+22
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,24 @@
11
<?php
22
// This is global bootstrap for autoloading
3+
4+
// Set a decently long SECURITY key with special chars etc
5+
define('SECURITY', '*)WT#&YHfd');
6+
// Whether or not to check SECHASH for validity, still checks if SECURITY defined as before if disabled
7+
define('SECHASH_CHECK', false);
8+
9+
// change SECHASH every second, we allow up to 3 sec back for slow servers
10+
if (SECHASH_CHECK) {
11+
function fip($tr=0) { return md5(SECURITY.(time()-$tr).SECURITY); }
12+
define('SECHASH', fip());
13+
function cfip() { return (fip()==SECHASH||fip(1)==SECHASH||fip(2)==SECHASH) ? 1 : 0; }
14+
} else {
15+
function cfip() { return (@defined('SECURITY')) ? 1 : 0; }
16+
}
17+
18+
19+
define("BASEPATH", dirname(__FILE__) . "/");
20+
21+
define('INCLUDE_DIR', BASEPATH . '../include');
22+
define('CLASS_DIR', INCLUDE_DIR . '/classes');
23+
define('PAGES_DIR', INCLUDE_DIR . '/pages');
24+
define('TEMPLATE_DIR', BASEPATH . '../templates');

tests/unit/BitcoinTest.php

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
require_once(CLASS_DIR . '/bitcoin.class.php');
4+
5+
class BitcoinTest extends \Codeception\TestCase\Test
6+
{
7+
8+
public function _before()
9+
{
10+
11+
}
12+
13+
public function _after()
14+
{
15+
16+
}
17+
18+
public function testAddressToHash160()
19+
{
20+
$bitcoin = new Bitcoin();
21+
$this->assertEquals('82839EADFB204C8D22ED122A0868C6F52B5BDFC9',$bitcoin->addressToHash160('1Cu6X3c716CCKU3Bi2jfHv8kZ2QCor8uXm'));
22+
}
23+
}

0 commit comments

Comments
 (0)