Пример #1
0
 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);
 }
Пример #2
0
 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');
 }
Пример #3
0
 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');
 }
Пример #4
0
 function testExceptions()
 {
     $I = new CodeGuy($this->scenario);
     $I->testMethod('UserModel.get');
     $user = new UserModel();
     $I->executeTestedMethodOn($user, 'name');
     $I->seeExceptionThrown('Exception');
     $this->runSteps();
 }
Пример #5
0
 public function goodByeWorld(\CodeGuy $I)
 {
     $I->executeTestedMethodOn(new $this->class())->seeResultNotEquals('hello world');
 }