Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Glossary entries #212

Merged
merged 2 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Classes/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ public function createGlossary(
];

$formatEntries = '';
foreach ($entries as $source => $target) {
foreach ($entries as $entry) {
$source = $entry['source'];
$target = $entry['target'];
$formatEntries .= sprintf(self::GLOSSARY_ENTRY_FORMAT, $source, $target);
}

Expand Down
42 changes: 33 additions & 9 deletions Tests/Functional/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ public function checkResponseFromCreateGlossary(): void
'de',
'en',
[
'hallo Welt' => 'hello world',
0 => [
'source' => 'hallo Welt',
'target' => 'hello world',
],
],
);

Expand All @@ -195,7 +198,10 @@ public function checkJsonFromCreateGlossaryIsValid(): void
'de',
'en',
[
'hallo Welt' => 'hello world',
0 => [
'source' => 'hallo Welt',
'target' => 'hello world',
],
],
);

Expand Down Expand Up @@ -241,7 +247,10 @@ public function checkJsonFromGetAllGlossariesIsValid(): void
'de',
'en',
[
'hallo Welt' => 'hello world',
0 => [
'source' => 'hallo Welt',
'target' => 'hello world',
],
],
);

Expand Down Expand Up @@ -279,7 +288,10 @@ public function checkResponseFromGetGlossary(): void
'de',
'en',
[
'hallo Welt' => 'hello world',
0 => [
'source' => 'hallo Welt',
'target' => 'hello world',
],
],
);

Expand All @@ -303,7 +315,10 @@ public function checkJsonFromGetGlossaryIsValid(): void
'de',
'en',
[
'hallo Welt' => 'hello world',
0 => [
'source' => 'hallo Welt',
'target' => 'hello world',
],
],
);

Expand Down Expand Up @@ -339,7 +354,10 @@ public function checkResponseFromDeleteGlossary(): void
'de',
'en',
[
'hallo Welt' => 'hello world',
0 => [
'source' => 'hallo Welt',
'target' => 'hello world',
],
],
);

Expand All @@ -363,7 +381,10 @@ public function checkResponseFromGetGlossaryEntries(): void
'de',
'en',
[
'hallo Welt' => 'hello world',
0 => [
'source' => 'hallo Welt',
'target' => 'hello world',
],
],
);

Expand All @@ -387,7 +408,10 @@ public function checkTextFromGetGlossaryEntriesIsValid(): void
'de',
'en',
[
'hallo Welt' => 'hello world',
0 => [
'source' => 'hallo Welt',
'target' => 'hello world',
],
],
);

Expand All @@ -397,7 +421,7 @@ public function checkTextFromGetGlossaryEntriesIsValid(): void

$content = $response->getBody()->getContents();

static::assertSame($content, sprintf("%s\t%s", 'hallo Welt', 'hello world'));
static::assertSame(sprintf("%s\t%s", 'hallo Welt', 'hello world'), $content);
}

protected function tearDown(): void
Expand Down