diff options
Diffstat (limited to 'vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer')
5 files changed, 175 insertions, 0 deletions
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.php new file mode 100644 index 00000000..1ded57a7 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.php | |||
@@ -0,0 +1,23 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | return array( | ||
13 | 'Entry1' => array( | ||
14 | 'Array' => array( | ||
15 | 0 => 'foo', | ||
16 | 1 => 'bar', | ||
17 | ), | ||
18 | 'Integer' => 5, | ||
19 | 'Boolean' => false, | ||
20 | 'Float' => 1.23, | ||
21 | ), | ||
22 | 'Entry2' => 'String', | ||
23 | ); | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.res b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.res new file mode 100644 index 00000000..7c1f71eb --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.res | |||
Binary files differ | |||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.txt b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.txt new file mode 100644 index 00000000..0ee0d7f2 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.txt | |||
@@ -0,0 +1,23 @@ | |||
1 | en{ | ||
2 | Entry1{ | ||
3 | Array{ | ||
4 | "foo", | ||
5 | "bar", | ||
6 | { | ||
7 | Key{"value"} | ||
8 | }, | ||
9 | } | ||
10 | Integer:int{5} | ||
11 | IntVector:intvector{ | ||
12 | 0, | ||
13 | 1, | ||
14 | 2, | ||
15 | 3, | ||
16 | } | ||
17 | FalseBoolean{"false"} | ||
18 | TrueBoolean{"true"} | ||
19 | Null{""} | ||
20 | Float{"1.23"} | ||
21 | } | ||
22 | Entry2{"String"} | ||
23 | } | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/PhpBundleWriterTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/PhpBundleWriterTest.php new file mode 100644 index 00000000..03302834 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/PhpBundleWriterTest.php | |||
@@ -0,0 +1,62 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Intl\Tests\ResourceBundle\Writer; | ||
13 | |||
14 | use Symfony\Component\Filesystem\Filesystem; | ||
15 | use Symfony\Component\Intl\ResourceBundle\Writer\PhpBundleWriter; | ||
16 | |||
17 | /** | ||
18 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
19 | */ | ||
20 | class PhpBundleWriterTest extends \PHPUnit_Framework_TestCase | ||
21 | { | ||
22 | /** | ||
23 | * @var PhpBundleWriter | ||
24 | */ | ||
25 | private $writer; | ||
26 | |||
27 | private $directory; | ||
28 | |||
29 | /** | ||
30 | * @var Filesystem | ||
31 | */ | ||
32 | private $filesystem; | ||
33 | |||
34 | protected function setUp() | ||
35 | { | ||
36 | $this->writer = new PhpBundleWriter(); | ||
37 | $this->directory = sys_get_temp_dir() . '/PhpBundleWriterTest/' . rand(1000, 9999); | ||
38 | $this->filesystem = new Filesystem(); | ||
39 | |||
40 | $this->filesystem->mkdir($this->directory); | ||
41 | } | ||
42 | |||
43 | protected function tearDown() | ||
44 | { | ||
45 | $this->filesystem->remove($this->directory); | ||
46 | } | ||
47 | |||
48 | public function testWrite() | ||
49 | { | ||
50 | $this->writer->write($this->directory, 'en', array( | ||
51 | 'Entry1' => array( | ||
52 | 'Array' => array('foo', 'bar'), | ||
53 | 'Integer' => 5, | ||
54 | 'Boolean' => false, | ||
55 | 'Float' => 1.23, | ||
56 | ), | ||
57 | 'Entry2' => 'String', | ||
58 | )); | ||
59 | |||
60 | $this->assertFileEquals(__DIR__ . '/Fixtures/en.php', $this->directory . '/en.php'); | ||
61 | } | ||
62 | } | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/TextBundleWriterTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/TextBundleWriterTest.php new file mode 100644 index 00000000..cbe0c8d8 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/TextBundleWriterTest.php | |||
@@ -0,0 +1,67 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Intl\Tests\ResourceBundle\Writer; | ||
13 | |||
14 | use Symfony\Component\Filesystem\Filesystem; | ||
15 | use Symfony\Component\Intl\ResourceBundle\Writer\TextBundleWriter; | ||
16 | |||
17 | /** | ||
18 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
19 | * | ||
20 | * @see http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt | ||
21 | */ | ||
22 | class TextBundleWriterTest extends \PHPUnit_Framework_TestCase | ||
23 | { | ||
24 | /** | ||
25 | * @var TextBundleWriter | ||
26 | */ | ||
27 | private $writer; | ||
28 | |||
29 | private $directory; | ||
30 | |||
31 | /** | ||
32 | * @var Filesystem | ||
33 | */ | ||
34 | private $filesystem; | ||
35 | |||
36 | protected function setUp() | ||
37 | { | ||
38 | $this->writer = new TextBundleWriter(); | ||
39 | $this->directory = sys_get_temp_dir() . '/TextBundleWriterTest/' . rand(1000, 9999); | ||
40 | $this->filesystem = new Filesystem(); | ||
41 | |||
42 | $this->filesystem->mkdir($this->directory); | ||
43 | } | ||
44 | |||
45 | protected function tearDown() | ||
46 | { | ||
47 | $this->filesystem->remove($this->directory); | ||
48 | } | ||
49 | |||
50 | public function testWrite() | ||
51 | { | ||
52 | $this->writer->write($this->directory, 'en', array( | ||
53 | 'Entry1' => array( | ||
54 | 'Array' => array('foo', 'bar', array('Key' => 'value')), | ||
55 | 'Integer' => 5, | ||
56 | 'IntVector' => array(0, 1, 2, 3), | ||
57 | 'FalseBoolean' => false, | ||
58 | 'TrueBoolean' => true, | ||
59 | 'Null' => null, | ||
60 | 'Float' => 1.23, | ||
61 | ), | ||
62 | 'Entry2' => 'String', | ||
63 | )); | ||
64 | |||
65 | $this->assertFileEquals(__DIR__ . '/Fixtures/en.txt', $this->directory . '/en.txt'); | ||
66 | } | ||
67 | } | ||