-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
119 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
use PHPUnit\Framework\TestCase; | ||
|
||
use function PHPUnit\Framework\assertEquals; | ||
use function PHPUnit\Framework\assertNotNull; | ||
|
||
final class BreadFormatsManagerTest extends TestCase | ||
{ | ||
private function getFormats($formats): array | ||
{ | ||
$json = file_get_contents('tests/formats/'.$formats.".json"); | ||
return json_decode($json, true)['formats']; | ||
} | ||
private function getFormatMgr($usedFormat, $lang) | ||
{ | ||
Bread_Bmlt::setFormatBase('german-formats'); | ||
return new Bread_FormatsManager($this->getFormats($usedFormat), $lang); | ||
} | ||
public function testGetFormatsUsed() { | ||
$mgr = $this->getFormatMgr('berlin-formats-de','de'); | ||
$used = $mgr->getFormatsUsed(); | ||
assertEquals(50,count($used)); | ||
$o1 = $mgr->getFormatByKey('de','O1'); | ||
assertNotNull($o1); | ||
$o1e = $mgr->getFormatByKey('en','O1'); | ||
assertNotNull($o1e); | ||
$used = $mgr->getFormatsUsed('en'); | ||
assertEquals(50,count($used)); | ||
} | ||
} |