BooleanNodeDefinitionTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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\Config\Tests\Definition\Builder;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition;
  13. class BooleanNodeDefinitionTest extends TestCase
  14. {
  15. /**
  16. * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException
  17. * @expectedExceptionMessage ->cannotBeEmpty() is not applicable to BooleanNodeDefinition.
  18. */
  19. public function testCannotBeEmptyThrowsAnException()
  20. {
  21. $def = new BooleanNodeDefinition('foo');
  22. $def->cannotBeEmpty();
  23. }
  24. public function testSetDeprecated()
  25. {
  26. $def = new BooleanNodeDefinition('foo');
  27. $def->setDeprecated('The "%path%" node is deprecated.');
  28. $node = $def->getNode();
  29. $this->assertTrue($node->isDeprecated());
  30. $this->assertSame('The "foo" node is deprecated.', $node->getDeprecationMessage($node->getName(), $node->getPath()));
  31. }
  32. }