sarga/tests/unit/Core/CoreCest.php

53 lines
1.1 KiB
PHP
Raw Normal View History

2020-02-04 10:18:40 +00:00
<?php
namespace Tests\Unit\Core;
use UnitTester;
2020-02-04 17:13:09 +00:00
use Codeception\Example;
2020-02-04 10:18:40 +00:00
class CoreCest
{
2020-02-04 13:31:18 +00:00
/**
* @param \UnitTester $I
*
* @param \Codeception\Example $scenario
*
* @throws \Exception
* @dataProvider getTaxRateScenarios
*
*/
public function testTaxRateAsIdentifier(UnitTester $I, Example $scenario): void
2020-02-04 10:18:40 +00:00
{
2020-02-04 13:31:18 +00:00
$I->assertEquals(
$scenario['expected'],
2020-02-04 17:13:09 +00:00
$I->executeFunction(
\Webkul\Core\Core::class,
'taxRateAsIdentifier',
[$scenario['input']]
)
2020-02-04 13:31:18 +00:00
);
}
protected function getTaxRateScenarios(): array
{
return [
2020-02-04 10:18:40 +00:00
[
'input' => 0,
'expected' => '0',
],
[
'input' => 0.01,
'expected' => '0_01',
],
[
2020-02-04 13:31:18 +00:00
'input' => .12,
2020-02-04 10:18:40 +00:00
'expected' => '0_12',
],
[
2020-02-04 13:31:18 +00:00
'input' => 1234.5678,
2020-02-04 10:18:40 +00:00
'expected' => '1234_5678',
],
];
}
}