コード例 #1
0
ファイル: StubTest.php プロジェクト: hitechdk/Codeception
 /**
  * @dataProvider matcherProvider
  */
 public function testMethodMatcherWithMakeEmptyExcept($count, $matcher)
 {
     $dummy = Stub::makeEmptyExcept('DummyClass', 'getCheckMe', array('goodByeWorld' => $matcher), $this);
     $this->repeatCall($count, array($dummy, 'goodByeWorld'));
 }
コード例 #2
0
ファイル: StubTest.php プロジェクト: BatVane/Codeception
 public function testMakeEmptyExceptProperyRepalced()
 {
     $dummy = Stub::makeEmptyExcept('DummyClass', 'getCheckMe', array('checkMe' => 'checked!'));
     $this->assertEquals('checked!', $dummy->getCheckMe());
 }
コード例 #3
0
ファイル: StubTest.php プロジェクト: pfz/codeception
 public function testStubsFromObject()
 {
     $dummy = Stub::make(new \DummyClass());
     $this->assertTrue(isset($dummy->__mocked));
     $dummy = Stub::makeEmpty(new \DummyClass());
     $this->assertTrue(isset($dummy->__mocked));
     $dummy = Stub::makeEmptyExcept(new \DummyClass(), 'helloWorld');
     $this->assertTrue(isset($dummy->__mocked));
     $dummy = Stub::construct(new \DummyClass());
     $this->assertTrue(isset($dummy->__mocked));
     $dummy = Stub::constructEmpty(new \DummyClass());
     $this->assertTrue(isset($dummy->__mocked));
     $dummy = Stub::constructEmptyExcept(new \DummyClass(), 'helloWorld');
     $this->assertTrue(isset($dummy->__mocked));
 }
コード例 #4
0
 public function testFindAll()
 {
     $stub_record = Stub::makeEmptyExcept('Comment', 'findAll', ['findBy' => Stub::once(function () {
         return true;
     })]);
     $stub_record->findAll();
 }
コード例 #5
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');
 }