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

MessageSelectorTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 16
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testChoose() 0 4 1
A testIsMultiChoice() 0 3 1
A setUp() 0 2 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Translation;
5
6
require __DIR__ . "/../../bootstrap.php";
7
8
use Tester\Assert;
9
10
/**
11
 * MessageSelectorTest
12
 *
13
 * @author Jakub Konečný
14
 * @testCase
15
 */
16
final class MessageSelectorTest extends \Tester\TestCase {
17
  protected MessageSelector $messageSelector;
18
  
19
  public function setUp(): void {
20
    $this->messageSelector = new MessageSelector();
21
  }
22
  
23
  public function testIsMultiChoice(): void {
24
    Assert::false($this->messageSelector->isMultiChoice("abc"));
25
    Assert::true($this->messageSelector->isMultiChoice("{0}abc|{1}def"));
26
  }
27
  
28
  public function testChoose(): void {
29
    $message = "abc";
30
    Assert::same($message, $this->messageSelector->choose($message, 0));
31
    Assert::same("abc", $this->messageSelector->choose("{0}abc|{1}def", 0));
32
  }
33
}
34
35
$test = new MessageSelectorTest();
36
$test->run();
37
?>