FormatterLocatorTest.php
1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace Aura\Intl;
class FormatterLocatorTest extends \PHPUnit_Framework_TestCase
{
public function test__constructAndGet()
{
$formatters = new FormatterLocator([
'mock' => function () {
return new \Aura\Intl\MockFormatter;
},
]);
$expect = 'Aura\Intl\MockFormatter';
$actual = $formatters->get('mock');
$this->assertInstanceOf($expect, $actual);
}
public function testSetAndGet()
{
$formatters = new FormatterLocator;
$formatters->set('mock', function () {
return new \Aura\Intl\MockFormatter;
});
$expect = 'Aura\Intl\MockFormatter';
$actual = $formatters->get('mock');
$this->assertInstanceOf($expect, $actual);
}
public function testGet_noSuchFormatter()
{
$formatters = new FormatterLocator;
$this->setExpectedException('Aura\Intl\Exception\FormatterNotMapped');
$formatters->get('noSuchFormatter');
}
}