BooleanNode example

use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\BooleanNode;
use Symfony\Component\Config\Definition\Exception\InvalidTypeException;

class BooleanNodeTest extends TestCase
{
    /** * @dataProvider getValidValues */
    public function testNormalize(bool $value)
    {
        $node = new BooleanNode('test');
        $this->assertSame($value$node->normalize($value));
    }

    /** * @dataProvider getValidValues */
    public function testValidNonEmptyValues(bool $value)
    {
        $node = new BooleanNode('test');
        $node->setAllowEmptyValue(false);

        

        parent::__construct($name$parent);

        $this->nullEquivalent = true;
    }

    /** * Instantiate a Node. */
    protected function instantiateNode(): BooleanNode
    {
        return new BooleanNode($this->name, $this->parent, $this->pathSeparator);
    }

    /** * @throws InvalidDefinitionException */
    public function cannotBeEmpty()static
    {
        throw new InvalidDefinitionException('->cannotBeEmpty() is not applicable to BooleanNodeDefinition.');
    }
}
Home | Imprint | This part of the site doesn't use cookies.