Created TranslateTextTest class.
Compare changes
+ 67
− 0
Closes #3488374
The provided Drupal unit test, TranslateTextTest
, focuses on testing the functionality of two classes: TranslateTextInput
and TranslateTextOutput
. These classes are part of a module named
ai
, specifically within the OperationType\TranslateText
namespace. The tests ensure that these classes can be properly created with valid input data and that their methods return expected
results.
Here's a summary of each test case:
Test Case: testTranslateTextInputCreation
TranslateTextInput
is created correctly.'Hello, world!'
, source language 'en'
, and target language 'es'
.toString()
and (string)
methods should return the original text `'Hello, world!'.getSourceLanguage()
method should return the source language 'en'
.getTargetLanguage()
method should return the target language 'es'
.setSourceLanguage
and setTargetLanguage
methods.Test Case: testTranslateTextOutputCreation
TranslateTextOutput
is created correctly.'¡Hola, mundo!'
, a raw output array containing the translated text, and metadata with a confidence level.getNormalized()
method should return the normalized text `'¡Hola, mundo!'.getRawOutput()
method should return the raw output array.getMetadata()
method should return the metadata.toArray
method.TranslateTextInput
and TranslateTextOutput
classes handle their properties and methods as expected.