public function testHasCheckedField() { $checkbox = $this->getMockBuilder('Behat\\Mink\\Element\\NodeElement')->disableOriginalConstructor()->getMock(); $checkbox->expects($this->exactly(2))->method('isChecked')->will($this->onConsecutiveCalls(true, false)); $this->mockNamedFinder('//field', array(array($checkbox), array(), array($checkbox)), array('field', 'some checkbox'), 3); $this->assertTrue($this->document->hasCheckedField('some checkbox')); $this->assertFalse($this->document->hasCheckedField('some checkbox')); $this->assertFalse($this->document->hasCheckedField('some checkbox')); }