Symfony\Component\DomCrawler\Field\ChoiceFormField::getType PHP Method

getType() public method

Returns the type of the choice field (radio, select, or checkbox).
public getType ( ) : string
return string The type
    public function getType()
    {
        return $this->type;
    }

Usage Example

Ejemplo n.º 1
0
 public function testGetType()
 {
     $node = $this->createNode('input', '', array('type' => 'radio', 'name' => 'name', 'value' => 'foo'));
     $field = new ChoiceFormField($node);
     $this->assertEquals('radio', $field->getType(), '->getType() returns radio for radio buttons');
     $node = $this->createNode('input', '', array('type' => 'checkbox', 'name' => 'name', 'value' => 'foo'));
     $field = new ChoiceFormField($node);
     $this->assertEquals('checkbox', $field->getType(), '->getType() returns radio for a checkbox');
     $node = $this->createNode('select', '');
     $field = new ChoiceFormField($node);
     $this->assertEquals('select', $field->getType(), '->getType() returns radio for a select');
 }