Я не могу решить проблему с тестированием в PHPUnit. Это мой код, и с ним что-то не так. Это расчет годовой процентной ставки (https://en.wikipedia.org/wiki/Annual_percentage_rate).
В 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>
Не думайте о модуле Oracle, это другая история. Я запустил "phpunit" после "установки композитора".
Проект / Тесты / Тест-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;
}
}
Проект / 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>
Не могу решить, пробовал много раз: (