/** * @dataProvider matcherProvider */ public function testMethodMatcherWithMakeEmptyExcept($count, $matcher) { $dummy = Stub::makeEmptyExcept('DummyClass', 'getCheckMe', array('goodByeWorld' => $matcher), $this); $this->repeatCall($count, array($dummy, 'goodByeWorld')); }
public function testMakeEmptyExceptProperyRepalced() { $dummy = Stub::makeEmptyExcept('DummyClass', 'getCheckMe', array('checkMe' => 'checked!')); $this->assertEquals('checked!', $dummy->getCheckMe()); }
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)); }
public function testFindAll() { $stub_record = Stub::makeEmptyExcept('Comment', 'findAll', ['findBy' => Stub::once(function () { return true; })]); $stub_record->findAll(); }
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'); }