Skip to content

Commit

Permalink
Update unittest for EditorStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
chrieinv committed Jul 19, 2023
1 parent 70d8c46 commit a6acf69
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,27 @@ public function provider_getLibraries(): \Generator
]
];
}

public function test_getLanguage(): void
{
/** @var H5PLibrary $lib */
$lib = H5PLibrary::factory()->create();
H5PLibraryLanguage::factory(1)->create([
'library_id' => $lib->id,
]);
$langCode = H5PLibraryLanguage::factory()->create([
'library_id' => $lib->id,
'translation' => '{"test":"success"}',
]);

$es = app(EditorStorage::class);
$result = $es->getLanguage(
$lib->name,
$lib->major_version,
$lib->minor_version,
$langCode->language_code
);
$translation = json_decode($result, true, flags: JSON_THROW_ON_ERROR);
$this->assertSame('success', $translation['test']);
}
}

0 comments on commit a6acf69

Please sign in to comment.