NativeLabelTranslatorStrategyTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /*
  3. * This file is part of the Sonata Project package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  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 Sonata\AdminBundle\Tests\Translator;
  11. use Sonata\AdminBundle\Translator\NativeLabelTranslatorStrategy;
  12. class NativeLabelTranslatorStrategyTest extends \PHPUnit_Framework_TestCase
  13. {
  14. /**
  15. * @dataProvider getLabelTests
  16. */
  17. public function testLabel($expectedLabel, $label)
  18. {
  19. $strategy = new NativeLabelTranslatorStrategy();
  20. $this->assertSame($expectedLabel, $strategy->getLabel($label, 'form', 'label'));
  21. }
  22. public function getLabelTests()
  23. {
  24. return array(
  25. array('Is Valid', 'isValid'),
  26. array('Is Valid', 'is_Valid'),
  27. array('Is0 Valid', 'is0Valid'),
  28. array('Is Valid', '_isValid'),
  29. array('Is Valid', '__isValid'),
  30. array('Is Valid', 'isValid_'),
  31. array('Is Valid', 'isValid__'),
  32. array('Is Valid', '__isValid__'),
  33. array('Is Valid Super Cool', 'isValid_SuperCool'),
  34. );
  35. }
  36. }