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 testFantaAdapter() { $resources = Stub::factory(Resource::class, 35); $arrayAdapter = new ArrayAdapter($resources); $pager = new Pagerfanta($arrayAdapter); $pagerAdapter = new PagerFantaAdapter($pager); $pager->setCurrentPage(4); $pager->setMaxPerPage(10); $this->assertEquals(4, $pagerAdapter->getCurrentPage()); $this->assertEquals(10, $pagerAdapter->getPerPage()); $this->assertEquals(35, $pagerAdapter->getTotal()); $this->assertEquals(5, $pagerAdapter->getCount()); $this->assertEquals(4, $pagerAdapter->getLastPage()); }
public function testFactory() { $dummies = Stub::factory('DummyClass', 2); $this->assertCount(2, $dummies); $this->assertInstanceOf('DummyClass', $dummies[0]); }
public function testJsonApiFormatterWithPagination() { $resources = \Codeception\Util\Stub::factory(\ObjectivePHP\Serializer\Resource\Resource::class, 15); //TODO: do an other test with pagination //$formatter->setPaginer(new \ObjectivePHP\Serializer\Paginer\PagerFantaAdapter(new \Pagerfanta\Pagerfanta(new \Pagerfanta\Adapter\ArrayAdapter([$resource])))); }