示例#1
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');
 }
示例#2
0
 function testMocks()
 {
     $I = new CodeGuy($this->scenario);
     $I->testMethod('UserService.create');
     $I->haveFakeClass($user = Stub::makeEmpty('UserModel'));
     $service = new UserService($user);
     $I->executeTestedMethodOn($service, 'davert');
     $I->seeMethodInvoked($user, 'save');
     $I->seeMethodInvokedOnce($user, 'save');
     $I->seeMethodInvokedMultipleTimes($user, 'set', 2);
     $I->seeMethodNotInvoked($user, 'get');
     $this->runSteps();
 }
示例#3
0
 public function shouldUseCest(CodeGuy $I)
 {
     $I->haveFakeClass($scenario = \Codeception\Util\Stub::makeEmptyExcept('Codeception\\Scenario', 'comment'));
     $I->executeMethod($scenario, 'comment', 'cool, that works!');
     $I->seeMethodInvoked($scenario, 'addStep');
 }