public function testIAttachToShouldCorrectlySubstituteSelector() { $this->setSessionExpectation(true); $input = $this->getMock('Behat\\Mink\\Element\\NodeElement', array(), array(), '', false, false); $input->expects($this->once())->method('attachFile')->will($this->returnValue(true)); $this->setFindExpectationWithReturnElement('input[name=picture]', $input); $this->context->iAttachTo('cat.jpeg', 'User Picture'); }
public function testIAttachToShouldThrowExceptionIfFileNotFound() { $this->setSessionExpectation(true); $input = $this->getMock('Behat\\Mink\\Element\\NodeElement', array(), array(), '', false, false); $input->expects($this->never())->method('attachFile'); $this->setFindExpectationWithReturnElement('input[name=picture]', $input); $this->setExpectedException('\\RuntimeException'); $this->context->iAttachTo('dog.jpeg', 'User Picture'); }