public function run(CodeGuy $I) { $I->wantTo('run steps from scenario'); $I->haveStub($test = Stub::makeEmpty('\\Codeception\\TestCase\\Cept')); $I->haveStub($scenario = Stub::make('\\Codeception\\Scenario', array('test' => $test, 'steps' => Stub::factory('\\Codeception\\Step', 2)))); $I->executeTestedMethodOn($scenario)->seeMethodInvoked($test, 'runStep')->seePropertyEquals($scenario, 'currentStep', 1); }
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'); }
public function makeAScreenshot(CodeGuy $I) { $I->wantTo('save screenshot'); $I->haveStub($selenium = Stub::makeEmpty('\\Codeception\\Module\\Selenium')); $I->haveFakeClass($stub = Stub::make($this->class, array('test' => Stub::makeEmpty('\\Codeception\\TestCase\\Cept', array('getFileName' => function () { return 'testtest'; })), 'module' => $selenium))); $I->executeTestedMethodOn($stub); $I->seeMethodInvoked($selenium, '_saveScreenshot'); $I->seeMethodNotInvoked($stub, 'debug'); }