Skip to content

Commit 6f9d7b5

Browse files
committed
run rector on tests
1 parent 7b734c4 commit 6f9d7b5

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

tests/php/AutoTranslateTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
class AutoTranslateTest extends SapphireTest
1414
{
1515
protected static $fixture_file = 'AutoTranslateTest.yml';
16+
1617
protected static $extra_dataobjects = [
1718
LocalisedDataObject::class,
1819
];
@@ -33,7 +34,7 @@ public function testCanTranslateIsTrueInDefaultLocale()
3334

3435
$dataObject = $this->objFromFixture(LocalisedDataObject::class, 'record_a');
3536
$this->assertTrue((bool)$dataObject->getSourceLocale()->IsGlobalDefault, 'Locale should be default locale');
36-
$this->assertTrue($dataObject->canTranslate(), 'We\'re only allowed to translate in default locale');
37+
$this->assertTrue($dataObject->canTranslate(), "We're only allowed to translate in default locale");
3738
});
3839
}
3940

@@ -45,7 +46,7 @@ public function testCanTranslateIsFalseInOtherLocale()
4546

4647
$dataObject = $this->objFromFixture(LocalisedDataObject::class, 'record_a');
4748
$this->assertFalse((bool)$dataObject->getSourceLocale()->IsGlobalDefault, 'Locale should not be default locale');
48-
$this->assertFalse($dataObject->canTranslate(), 'We\'re not allowed to translate in other locales');
49+
$this->assertFalse($dataObject->canTranslate(), "We're not allowed to translate in other locales");
4950
});
5051
}
5152

@@ -59,7 +60,7 @@ public function testUnpriviledgedUserCannotTranslate()
5960
$dataObject = $this->objFromFixture(LocalisedDataObject::class, 'record_a');
6061
$dataObject->setCanEdit(false);
6162
$this->assertTrue((bool)$dataObject->getSourceLocale()->IsGlobalDefault, 'Locale should be default locale');
62-
$this->assertFalse($dataObject->canTranslate(), 'We\'re only allowed to translate in default locale');
63+
$this->assertFalse($dataObject->canTranslate(), "We're only allowed to translate in default locale");
6364
});
6465
}
6566

@@ -95,6 +96,7 @@ public function testAutoTranslateFailures()
9596

9697
$emptyDataObject = LocalisedDataObject::create(['Locale' => 'en_US']);
9798
$emptyDataObject->write();
99+
98100
$status = $emptyDataObject->autoTranslate();
99101
$this->assertEquals(AITranslationStatus::ERRORMSG_NOTHINGFOUND, $status->getMessage(), 'AutoTranslate should fail if no data found');
100102
});

tests/php/Stub/LocalisedDataObject.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,22 @@
99

1010
class LocalisedDataObject extends DataObject implements TestOnly
1111
{
12+
/**
13+
* @config
14+
*/
1215
private static $table_name = 'FluentExImTest_LocalisedDataObject';
1316

17+
/**
18+
* @config
19+
*/
1420
private static $db = [
1521
'Title' => 'Varchar',
1622
'Content' => 'HTMLText',
1723
];
1824

25+
/**
26+
* @config
27+
*/
1928
private static $extensions = [
2029
FluentExtension::class,
2130
AutoTranslate::class

tests/php/Translator/MockTranslator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function translate(string $text, string $targetLocale): string
1818
foreach ($translations as $key => $value) {
1919
$translations[$key] = $value . ' (translated to ' . $targetLocale . ')';
2020
}
21+
2122
return json_encode($translations);
2223
}
2324
}

0 commit comments

Comments
 (0)