本文整理汇总了PHP中Codeception\Util\Stub::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Stub::factory方法的具体用法?PHP Stub::factory怎么用?PHP Stub::factory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Codeception\Util\Stub
的用法示例。
在下文中一共展示了Stub::factory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
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: testFantaAdapter
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());
}
示例3: testFactory
public function testFactory()
{
$dummies = Stub::factory('DummyClass', 2);
$this->assertCount(2, $dummies);
$this->assertInstanceOf('DummyClass', $dummies[0]);
}
示例4: testJsonApiFormatterWithPagination
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]))));
}