I can't solve the problem with testing in PHPUnit. This is my code, and there's sommething wrong with it. This is the Annual percentage rate calculation ( https://en.wikipedia.org/wiki/Annual_percentage_rate ).
In cmd:
C:\Users\Shambler\Downloads\test-taeg-senior\test-taeg>phpunit
PHP Warning: Module 'oci8' already loaded in Unknown on line 0
Warning: Module 'oci8' already loaded in Unknown on line 0
PHPUnit 3.7.21 by Sebastian Bergmann.
Configuration read from C:\Users\Shambler\Downloads\test-taeg-senior\test-taeg\phpunit.xml
Time: 74 ms, Memory: 2.00MB
No tests executed!
C:\Users\Shambler\Downloads\test-taeg-senior\test-taeg>
Don't think about Oracle module, it's another story. I ran "phpunit" after "composer install".
project/tests/test-general.php:
<?php
use MotorK\{ Rate, Tae, Taeg };
class TestTaeg extends \PHPUnit\Framework\TestCase {
/**
* Example from http://www.calcolatoremutui.it/tan-e-taeg/
*/
public function test_tae() {
$obj = Tae::init( 5, 12 );
$this->assertEquals( 5.116, round( $obj->calculate(), 3 ) );
$this->expectOutputString( '5.116 %' );
echo $obj;
}
/**
* Example from http://www.calcolatoremutui.it/tan-e-taeg/
*/
public function test_rate() {
$obj = Rate::init( 100000, 5, 12, 20 );
$this->assertEquals( 659.96, round( $obj->calculate(), 2 ) );
$this->expectOutputString( '659.96 €' );
echo $obj;
}
/**
* Example from http://www.calcolatoremutui.it/tan-e-taeg/
*/
public function test_taeg() {
$obj = Taeg::init( 99000, 5, 661.96, 12, 20 );
$this->assertEquals( 5.281, round( $obj->calculate(), 3 ) );
$this->expectOutputString( '5.281 %' );
echo $obj;
}
}
project/phpunit.xml
<phpunit
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
>
<testsuite name="Internal tests">
<directory prefix="test-" suffix=".php">./tests/</directory>
</testsuite>
<groups>
<include>
<group>default</group>
</include>
</groups>
<filter>
<whitelist>
<directory suffix=".php">./includes/</directory>
</whitelist>
</filter>
I can't solve it, tried it many times :(