You are here

class IcuResFileLoaderTest in Plug 7

Hierarchy

  • class \Symfony\Component\Translation\Tests\Loader\LocalizedTestCase extends \Symfony\Component\Translation\Tests\Loader\PHPUnit_Framework_TestCase

Expanded class hierarchy of IcuResFileLoaderTest

File

lib/Symfony/translation/Tests/Loader/IcuResFileLoaderTest.php, line 17

Namespace

Symfony\Component\Translation\Tests\Loader
View source
class IcuResFileLoaderTest extends LocalizedTestCase {
  protected function setUp() {
    if (!extension_loaded('intl')) {
      $this
        ->markTestSkipped('This test requires intl extension to work.');
    }
  }
  public function testLoad() {

    // resource is build using genrb command
    $loader = new IcuResFileLoader();
    $resource = __DIR__ . '/../fixtures/resourcebundle/res';
    $catalogue = $loader
      ->load($resource, 'en', 'domain1');
    $this
      ->assertEquals(array(
      'foo' => 'bar',
    ), $catalogue
      ->all('domain1'));
    $this
      ->assertEquals('en', $catalogue
      ->getLocale());
    $this
      ->assertEquals(array(
      new DirectoryResource($resource),
    ), $catalogue
      ->getResources());
  }

  /**
   * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
   */
  public function testLoadNonExistingResource() {
    $loader = new IcuResFileLoader();
    $loader
      ->load(__DIR__ . '/../fixtures/non-existing.txt', 'en', 'domain1');
  }

  /**
   * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
   */
  public function testLoadInvalidResource() {
    $loader = new IcuResFileLoader();
    $loader
      ->load(__DIR__ . '/../fixtures/resourcebundle/corrupted', 'en', 'domain1');
  }

}

Members