Test Failed
Push — master ( 8413e5...65cae7 )
by Jakub
02:11
created

MessagesCatalogueTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 15
dl 0
loc 22
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A testCatalogueWithoutResources() 0 5 1
A testGetFolders() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Translation\Loaders;
5
6
use Tester\Assert;
7
use Nexendrie\Translation\Resolvers\ManualLocaleResolver;
8
use Nexendrie\Translation\CatalogueCompiler;
9
10
require __DIR__ . "/../../../bootstrap.php";
11
12
/**
13
 * @author Jakub Konečný
14
 * @testCase
15
 */
16
final class MessagesCatalogueTest extends FileLoaderTestAbstract {
17
  protected function setUp(): void {
18
    $folders = [__DIR__ . "/../../../lang", __DIR__ . "/../../../lang2"];
19
    $folder = __DIR__ . "/../../../_temp/catalogues";
20
    $loader = new NeonLoader(new ManualLocaleResolver(), $folders);
21
    $compiler = new CatalogueCompiler($loader, $folder, ["en", "cs"]);
22
    $compiler->compile();
23
    $this->loader = new MessagesCatalogue(new ManualLocaleResolver(), [$folder]);
24
  }
25
  
26
  public function testGetFolders(): void {
27
    $folders = $this->loader->folders;
28
    Assert::type("array", $folders);
29
    Assert::count(1, $folders);
30
    Assert::same(__DIR__ . "/../../../_temp/catalogues", $folders[0]);
31
  }
32
  
33
  public function testCatalogueWithoutResources(): void {
34
    $folder = __DIR__ . "/../../../catalogue";
35
    $loader = new MessagesCatalogue(new ManualLocaleResolver(), [$folder]);
36
    $loader->getTexts();
1 ignored issue
show
Deprecated Code introduced by
The function Nexendrie\Translation\Lo...\FileLoader::getTexts() has been deprecated: Access the property directly ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

36
    /** @scrutinizer ignore-deprecated */ $loader->getTexts();

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
37
    Assert::count(3, $loader->resources);
38
  }
39
}
40
41
$test = new MessagesCatalogueTest();
42
$test->run();
43
?>