Skip to content

Commit

Permalink
[Translation] add Mo loader tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stealth35 committed Nov 9, 2011
1 parent 9af2342 commit 9c2a26d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Tests\Component\Translation\Loader;

use Symfony\Component\Translation\Loader\MoFileLoader;
use Symfony\Component\Config\Resource\FileResource;

class MoFileLoaderTest extends \PHPUnit_Framework_TestCase
{
public function testLoad()
{
$loader = new MoFileLoader();
$resource = __DIR__.'/../fixtures/resources.mo';
$catalogue = $loader->load($resource, 'en', 'domain1');

$this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
$this->assertEquals('en', $catalogue->getLocale());
$this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
}

public function testLoadDoesNothingIfEmpty()
{
$loader = new MoFileLoader();
$resource = __DIR__.'/../fixtures/empty.mo';
$catalogue = $loader->load($resource, 'en', 'domain1');

$this->assertEquals(array(), $catalogue->all('domain1'));
$this->assertEquals('en', $catalogue->getLocale());
$this->assertEquals(array(new FileResource($resource)), $catalogue->getResources());
}
}
Empty file.
Binary file not shown.

0 comments on commit 9c2a26d

Please sign in to comment.