public function testOptionWithNoValue() { $node = $this->createSelectNodeWithEmptyOption(array('foo' => false, 'bar' => false)); $field = new ChoiceFormField($node); $field->select('foo'); $this->assertEquals('foo', $field->getValue(), '->select() changes the selected option'); }
public function testSelect() { $node = $this->createNode('input', '', array('type' => 'checkbox', 'name' => 'name', 'checked' => 'checked')); $field = new ChoiceFormField($node); $field->select(true); $this->assertEquals(1, $field->getValue(), '->select() changes the value of the field'); $field->select(false); $this->assertEquals(null, $field->getValue(), '->select() changes the value of the field'); $node = $this->createSelectNode(array('foo' => false, 'bar' => false)); $field = new ChoiceFormField($node); $field->select('foo'); $this->assertEquals('foo', $field->getValue(), '->select() changes the selected option'); }