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

testCatalogueWithoutResources()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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
?>