public function convertWithException(\CodeGuy $I) { $I->wantTo("test if converting of different measure types fails."); $I->haveStub($converter = Stub::make($this->class)); $I->amTestingMethod('\\Measure\\Converter.convert'); $I->executeTestedMethodOn($converter, 1, 'liter', 'kg'); $I->seeExceptionThrown('\\ErrorException'); }
function testExceptions() { $I = new CodeGuy($this->scenario); $I->testMethod('UserModel.get'); $user = new UserModel(); $I->executeTestedMethodOn($user, 'name'); $I->seeExceptionThrown('Exception'); $this->runSteps(); }