@@ -11,10 +11,8 @@ |
||
| 11 | 11 | * @author Jakub Konečný |
| 12 | 12 | * @testCase |
| 13 | 13 | */ |
| 14 | -final class YamlLoaderTest extends FileLoaderTestAbstract |
|
| 15 | -{ |
|
| 16 | - protected function setUp() |
|
| 17 | - { |
|
| 14 | +final class YamlLoaderTest extends FileLoaderTestAbstract { |
|
| 15 | + protected function setUp() { |
|
| 18 | 16 | $folders = [__DIR__ . "/../../../lang", __DIR__ . "/../../../lang2"]; |
| 19 | 17 | $this->loader = new YamlLoader(new ManualLocaleResolver(), $folders); |
| 20 | 18 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function testSetFolders(): void |
| 44 | 44 | { |
| 45 | - Assert::exception(function (): void { |
|
| 45 | + Assert::exception(function(): void { |
|
| 46 | 46 | $this->loader->folders = [""]; |
| 47 | 47 | }, InvalidFolderException::class, "Folder does not exist."); |
| 48 | 48 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | Assert::count(2, $resources["book"]); |
| 72 | 72 | Assert::count(2, $resources["abc"]); |
| 73 | 73 | // the language does not exist, 1 (default) resource for each domain |
| 74 | - if ($this->loader instanceof MessagesCatalogue) { |
|
| 74 | + if($this->loader instanceof MessagesCatalogue) { |
|
| 75 | 75 | return; // the following tests for some reason fail with MessagesCatalogue |
| 76 | 76 | } |
| 77 | 77 | $this->loader->lang = "xyz"; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | Assert::count(3, $texts["messages"]); |
| 102 | 102 | Assert::type("array", $texts["book"]); |
| 103 | 103 | Assert::count(5, $texts["book"]); |
| 104 | - if ($this->loader instanceof MessagesCatalogue) { |
|
| 104 | + if($this->loader instanceof MessagesCatalogue) { |
|
| 105 | 105 | return; // the following tests for some reason fail with MessagesCatalogue |
| 106 | 106 | } |
| 107 | 107 | $this->loader->lang = "xyz"; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | public function testNoFolder(): void |
| 118 | 118 | { |
| 119 | - Assert::exception(function (): void { |
|
| 119 | + Assert::exception(function(): void { |
|
| 120 | 120 | $class = get_class($this->loader); |
| 121 | 121 | $this->loader = new $class(); |
| 122 | 122 | $this->loader->getTexts(); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | Assert::count(2, $result); |
| 131 | 131 | Assert::contains("en", $result); |
| 132 | 132 | Assert::contains("cs", $result); |
| 133 | - Assert::exception(function (): void { |
|
| 133 | + Assert::exception(function(): void { |
|
| 134 | 134 | $class = get_class($this->loader); |
| 135 | 135 | $this->loader = new $class(); |
| 136 | 136 | $this->loader->getAvailableLanguages(); |
@@ -11,10 +11,8 @@ |
||
| 11 | 11 | * @author Jakub Konečný |
| 12 | 12 | * @testCase |
| 13 | 13 | */ |
| 14 | -final class IniLoaderTest extends FileLoaderTestAbstract |
|
| 15 | -{ |
|
| 16 | - protected function setUp() |
|
| 17 | - { |
|
| 14 | +final class IniLoaderTest extends FileLoaderTestAbstract { |
|
| 15 | + protected function setUp() { |
|
| 18 | 16 | $folders = [__DIR__ . "/../../../lang", __DIR__ . "/../../../lang2"]; |
| 19 | 17 | $this->loader = new IniLoader(new ManualLocaleResolver(), $folders); |
| 20 | 18 | } |
@@ -12,10 +12,8 @@ |
||
| 12 | 12 | * @author Jakub Konečný |
| 13 | 13 | * @testCase |
| 14 | 14 | */ |
| 15 | -final class PhpLoaderTest extends FileLoaderTestAbstract |
|
| 16 | -{ |
|
| 17 | - protected function setUp() |
|
| 18 | - { |
|
| 15 | +final class PhpLoaderTest extends FileLoaderTestAbstract { |
|
| 16 | + protected function setUp() { |
|
| 19 | 17 | $folders = [__DIR__ . "/../../../lang", __DIR__ . "/../../../lang2"]; |
| 20 | 18 | $this->loader = new PhpLoader(new ManualLocaleResolver(), $folders); |
| 21 | 19 | } |
@@ -11,10 +11,8 @@ |
||
| 11 | 11 | * @author Jakub Konečný |
| 12 | 12 | * @testCase |
| 13 | 13 | */ |
| 14 | -final class NeonLoaderTest extends FileLoaderTestAbstract |
|
| 15 | -{ |
|
| 16 | - protected function setUp() |
|
| 17 | - { |
|
| 14 | +final class NeonLoaderTest extends FileLoaderTestAbstract { |
|
| 15 | + protected function setUp() { |
|
| 18 | 16 | $folders = [__DIR__ . "/../../../lang", __DIR__ . "/../../../lang2"]; |
| 19 | 17 | $this->loader = new NeonLoader(new ManualLocaleResolver(), $folders); |
| 20 | 18 | } |
@@ -13,8 +13,7 @@ |
||
| 13 | 13 | * @author Jakub Konečný |
| 14 | 14 | * @testCase |
| 15 | 15 | */ |
| 16 | -final class MessagesCatalogueTest extends FileLoaderTestAbstract |
|
| 17 | -{ |
|
| 16 | +final class MessagesCatalogueTest extends FileLoaderTestAbstract { |
|
| 18 | 17 | protected function setUp(): void |
| 19 | 18 | { |
| 20 | 19 | $folders = [__DIR__ . "/../../../lang", __DIR__ . "/../../../lang2"]; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | ] |
| 115 | 115 | ] |
| 116 | 116 | ]; |
| 117 | - Assert::exception(function () use ($config) { |
|
| 117 | + Assert::exception(function() use ($config) { |
|
| 118 | 118 | $this->refreshContainer($config); |
| 119 | 119 | }, InvalidLoaderException::class); |
| 120 | 120 | $config = [ |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | ] |
| 125 | 125 | ] |
| 126 | 126 | ]; |
| 127 | - Assert::exception(function () use ($config) { |
|
| 127 | + Assert::exception(function() use ($config) { |
|
| 128 | 128 | $this->refreshContainer($config); |
| 129 | 129 | }, InvalidLoaderException::class); |
| 130 | 130 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | "localeResolver" => "invalid" |
| 176 | 176 | ] |
| 177 | 177 | ]; |
| 178 | - Assert::exception(function () use ($config) { |
|
| 178 | + Assert::exception(function() use ($config) { |
|
| 179 | 179 | $this->refreshContainer($config); |
| 180 | 180 | }, InvalidLocaleResolverException::class); |
| 181 | 181 | $config = [ |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | "localeResolver" => \stdClass::class |
| 184 | 184 | ] |
| 185 | 185 | ]; |
| 186 | - Assert::exception(function () use ($config) { |
|
| 186 | + Assert::exception(function() use ($config) { |
|
| 187 | 187 | $this->refreshContainer($config); |
| 188 | 188 | }, InvalidLocaleResolverException::class); |
| 189 | 189 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | ] |
| 251 | 251 | ] |
| 252 | 252 | ]; |
| 253 | - Assert::exception(function () use ($config) { |
|
| 253 | + Assert::exception(function() use ($config) { |
|
| 254 | 254 | $this->refreshContainer($config); |
| 255 | 255 | }, InvalidFolderException::class); |
| 256 | 256 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | "messageSelector" => \stdClass::class |
| 283 | 283 | ] |
| 284 | 284 | ]; |
| 285 | - Assert::exception(function () use ($config) { |
|
| 285 | + Assert::exception(function() use ($config) { |
|
| 286 | 286 | $this->refreshContainer($config); |
| 287 | 287 | }, InvalidMessageSelectorException::class); |
| 288 | 288 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | "debugger" => false |
| 299 | 299 | ] |
| 300 | 300 | ]; |
| 301 | - Assert::exception(function () use ($config) { |
|
| 301 | + Assert::exception(function() use ($config) { |
|
| 302 | 302 | $this->refreshContainer($config); |
| 303 | 303 | $panel = $this->getService(TranslationPanel::class); |
| 304 | 304 | Assert::type(TranslationPanel::class, $panel); |
@@ -10,8 +10,7 @@ |
||
| 10 | 10 | * |
| 11 | 11 | * @author Jakub Konečný |
| 12 | 12 | */ |
| 13 | -final class ProviderExtension extends CompilerExtension implements TranslationProvider |
|
| 14 | -{ |
|
| 13 | +final class ProviderExtension extends CompilerExtension implements TranslationProvider { |
|
| 15 | 14 | /** |
| 16 | 15 | * @return string[] |
| 17 | 16 | */ |
@@ -41,24 +41,24 @@ |
||
| 41 | 41 | $text = (string) $r->p; |
| 42 | 42 | Assert::same("Untranslated messages: 0, loaded resources 0", $text); |
| 43 | 43 | Assert::same("Resolved language", (string) $r->div->div->h1); |
| 44 | - foreach ($r->div->div->table->tr->children() as $i => $td) { |
|
| 45 | - if ($i === 0) { |
|
| 44 | + foreach($r->div->div->table->tr->children() as $i => $td) { |
|
| 45 | + if($i === 0) { |
|
| 46 | 46 | Assert::same("ManualLocaleResolver", (string) $td); |
| 47 | - } elseif ($i === 1) { |
|
| 47 | + } elseif($i === 1) { |
|
| 48 | 48 | Assert::same("en", (string) $td); |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | - foreach ($r->children() as $i1 => $div) { |
|
| 52 | - if ($i1 === 1) { |
|
| 51 | + foreach($r->children() as $i1 => $div) { |
|
| 52 | + if($i1 === 1) { |
|
| 53 | 53 | Assert::same("Loaded resources", (string) $div->h1); |
| 54 | - foreach ($div->table->th as $i2 => $td) { |
|
| 55 | - if ($i2 === 0) { |
|
| 54 | + foreach($div->table->th as $i2 => $td) { |
|
| 55 | + if($i2 === 0) { |
|
| 56 | 56 | Assert::same("Domain", (string) $td); |
| 57 | - } elseif ($i2 === 1) { |
|
| 57 | + } elseif($i2 === 1) { |
|
| 58 | 58 | Assert::same("Filename", (string) $td); |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | - } elseif ($i1 === 2) { |
|
| 61 | + } elseif($i1 === 2) { |
|
| 62 | 62 | Assert::count(0, $div->children()); |
| 63 | 63 | } |
| 64 | 64 | } |