public function TranslationProgressCalculatorTest::testCalculate in TMGMT Translator Smartling 8.3
Tests calculate.
@dataProvider providerTestCalculate
Parameters
$auto_authorize:
$test_data:
$logger_called_times:
$result:
Throws
\Exception
File
- tests/
src/ Kernel/ TranslationProgressCalculatorTest.php, line 26
Class
- TranslationProgressCalculatorTest
- Tests for progress calculator.
Namespace
Drupal\Tests\tmgmt_smartling\KernelCode
public function testCalculate($auto_authorize, $test_data, $logger_called_times, $result) {
$logger_mock = $this
->getMockBuilder('\\Drupal\\Core\\Logger\\LoggerChannel')
->setMethods([
"warning",
])
->disableOriginalConstructor()
->getMock();
$logger_mock
->expects($this
->exactly($logger_called_times))
->method("warning")
->with(t("Translation progress in dashboard 100% but for the connector progress = @percentage%.", [
"@percentage" => $result,
]));
$calculator = new TranslationProgressCalculator($logger_mock);
$this
->assertEquals($calculator
->calculate($test_data, $auto_authorize), $result);
}