AbstractBundleTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Intl\Tests\ResourceBundle;
  11. /**
  12. * @author Bernhard Schussek <bschussek@gmail.com>
  13. */
  14. class AbstractBundleTest extends \PHPUnit_Framework_TestCase
  15. {
  16. const RES_DIR = '/base/dirName';
  17. /**
  18. * @var \Symfony\Component\Intl\ResourceBundle\AbstractBundle
  19. */
  20. private $bundle;
  21. /**
  22. * @var \PHPUnit_Framework_MockObject_MockObject
  23. */
  24. private $reader;
  25. protected function setUp()
  26. {
  27. $this->reader = $this->getMock('Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface');
  28. $this->bundle = $this->getMockForAbstractClass(
  29. 'Symfony\Component\Intl\ResourceBundle\AbstractBundle',
  30. array(self::RES_DIR, $this->reader)
  31. );
  32. $this->bundle->expects($this->any())
  33. ->method('getDirectoryName')
  34. ->will($this->returnValue('dirName'));
  35. }
  36. public function testGetLocales()
  37. {
  38. $locales = array('de', 'en', 'fr');
  39. $this->reader->expects($this->once())
  40. ->method('getLocales')
  41. ->with(self::RES_DIR)
  42. ->will($this->returnValue($locales));
  43. $this->assertSame($locales, $this->bundle->getLocales());
  44. }
  45. }