public function testCheckField() { $node = $this->getMockBuilder('Behat\\Mink\\Element\\NodeElement')->disableOriginalConstructor()->getMock(); $node->expects($this->once())->method('check'); $this->mockNamedFinder('//field', array($node), array('field', 'some field')); $this->document->checkField('some field'); $this->setExpectedException('Behat\\Mink\\Exception\\ElementNotFoundException'); $this->document->checkField('some field'); }
/** * Set meta tag value for group of checkboxes. * * Existing selection will be cleared before new values are applied. * * @param \Behat\Mink\Element\DocumentElement $page * Current active page. * @param string $fieldName * Field name. * @param string $value * Comma separated values for meta tag checkboxes. */ protected function setCheckboxMetaTag(DocumentElement $page, $fieldName, $value) { // UnCheck all checkboxes and check defined. $this->getSession()->executeScript("jQuery('input[name*=\"{$fieldName}\"]').prop('checked', false);"); $checkNames = explode(',', $value); foreach ($checkNames as $checkName) { $checkBoxName = $fieldName . '[' . trim($checkName) . ']'; $this->scrollElementInView('[name="' . $checkBoxName . '"]'); $page->checkField($checkBoxName); } }