SymfonyComponentTranslationTestsLoggingTranslatorTest

The Simple Calendar Symfony Component Translation Tests LoggingTranslatorTest class.

Defined (1)

The class is defined in the following location(s).

/vendor/symfony/translation/Tests/LoggingTranslatorTest.php  
  1. class LoggingTranslatorTest extends \PHPUnit_Framework_TestCase 
  2. public function testTransWithNoTranslationIsLogged() 
  3. $logger = $this->getMock('Psr\Log\LoggerInterface'); 
  4. $logger->expects($this->exactly(2)) 
  5. ->method('warning') 
  6. ->with('Translation not found.') 
  7.  
  8. $translator = new Translator('ar'); 
  9. $loggableTranslator = new LoggingTranslator($translator, $logger); 
  10. $loggableTranslator->transChoice('some_message2', 10, array('%count%' => 10)); 
  11. $loggableTranslator->trans('bar'); 
  12.  
  13. public function testTransChoiceFallbackIsLogged() 
  14. $logger = $this->getMock('Psr\Log\LoggerInterface'); 
  15. $logger->expects($this->once()) 
  16. ->method('debug') 
  17. ->with('Translation use fallback catalogue.') 
  18.  
  19. $translator = new Translator('ar'); 
  20. $translator->setFallbackLocales(array('en')); 
  21. $translator->addLoader('array', new ArrayLoader()); 
  22. $translator->addResource('array', array('some_message2' => 'one thing|%count% things'), 'en'); 
  23. $loggableTranslator = new LoggingTranslator($translator, $logger); 
  24. $loggableTranslator->transChoice('some_message2', 10, array('%count%' => 10));