sarga/tests/unit/Core/CoreCest.php

49 lines
1.0 KiB
PHP
Raw Normal View History

2020-02-04 10:18:40 +00:00
<?php
namespace Tests\Unit\Core;
2020-02-04 13:31:18 +00:00
use Codeception\Example;
2020-02-04 10:18:40 +00:00
use UnitTester;
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'],
$I->executeFunction(\Webkul\Core\Core::class, 'taxRateAsIdentifier', [$scenario['input']])
);
}
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',
],
];
}
}