/** * Returns true if the form was submitted, false otherwise. * * @return boolean */ public function isSubmitted() { if ($this->formNode->getAttribute('name') === $this->request->get(static::DEFORM_ID)) { return true; } return false; }
function it_should_parse_mixed_checkbox_elements(Node $node1, Node $node2, Node $node3, Node $node4, Node $node5, Node $node6) { foreach (func_get_args() as $node) { $node->getElementType()->shouldBeCalled()->willReturn('input_checkbox'); } $node1->getAttribute('name')->willReturn('foo'); $node2->getAttribute('name')->willReturn('foo'); $node3->getAttribute('name')->willReturn('foo'); $node4->getAttribute('name')->willReturn('bar'); $node5->getAttribute('name')->willReturn('bar'); $node6->getAttribute('name')->willReturn('foobar'); $this->createFromNodes(func_get_args())->shouldReturnMixedNodes(['foo' => ['className' => 'DeForm\\Element\\CheckboxGroupElement', 'length' => 3], 'bar' => ['className' => 'DeForm\\Element\\CheckboxGroupElement', 'length' => 2], 'foobar' => 'DeForm\\Element\\CheckboxElement']); }
/** * Return the validation rules for element. * * @return string|null */ public function getValidationRules() { return $this->node->getAttribute('data-validate'); }
function it_should_return_name_of_element(NodeInterface $node) { $node->getAttribute('name')->shouldBeCalled()->willReturn('foo'); $this->getName()->shouldReturn('foo'); }
function it_should_return_element_value_from_request(NodeInterface $node, RequestInterface $request) { $node->getAttribute('name')->willReturn('foo')->shouldBeCalled(); $request->file('foo')->willReturn('bar')->shouldBeCalled(); $this->getValue()->shouldBe('bar'); }
function let(Node $formNode, Document $document, Request $request, ValidationHelper $validationHelper) { $formNode->getAttribute('name')->willReturn('foo'); $this->beConstructedWith($formNode, $document, $request, $validationHelper); }