本文整理汇总了PHP中Codeception\Util\Stub::never方法的典型用法代码示例。如果您正苦于以下问题:PHP Stub::never方法的具体用法?PHP Stub::never怎么用?PHP Stub::never使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Codeception\Util\Stub
的用法示例。
在下文中一共展示了Stub::never方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBuildingWithCustomService
public function testBuildingWithCustomService()
{
/* Given... (Fixture) */
$params = Stub::makeEmpty('GoIntegro\\Hateoas\\JsonApi\\Request\\Params', ['primaryType' => 'users']);
$defaultBuilder = Stub::makeEmpty('GoIntegro\\Hateoas\\Entity\\AbstractBuilderInterface', ['create' => Stub::never()]);
$userBuilder = Stub::makeEmpty('GoIntegro\\Hateoas\\Entity\\BuilderInterface', ['create' => Stub::once()]);
$builder = new Builder();
$builder->addBuilder($defaultBuilder, Builder::DEFAULT_BUILDER)->addBuilder($userBuilder, 'users');
/* When... (Action) */
$entity = $builder->create($params, [], []);
/* Then... (Assertions) */
}
示例2: testDeletingWithCustomService
public function testDeletingWithCustomService()
{
/* Given... (Fixture) */
$params = Stub::makeEmpty('GoIntegro\\Hateoas\\JsonApi\\Request\\Params', ['primaryType' => 'users']);
$entity = Stub::makeEmpty('GoIntegro\\Hateoas\\JsonApi\\ResourceEntityInterface');
$defaultDeleter = Stub::makeEmpty('GoIntegro\\Hateoas\\Entity\\DeleterInterface', ['create' => Stub::never()]);
$userDeleter = Stub::makeEmpty('GoIntegro\\Hateoas\\Entity\\DeleterInterface', ['create' => Stub::once()]);
$deleter = new Deleter();
$deleter->addDeleter($defaultDeleter, Deleter::DEFAULT_DELETER)->addDeleter($userDeleter, 'users');
/* When... (Action) */
$entity = $deleter->delete($params, $entity);
/* Then... (Assertions) */
}
示例3: testDeletingWithCustomService
public function testDeletingWithCustomService()
{
/* Given... (Fixture) */
$params = Stub::makeEmpty('GoIntegro\\Hateoas\\JsonApi\\Request\\Params', ['primaryType' => 'users']);
$entity = Stub::makeEmpty('GoIntegro\\Hateoas\\JsonApi\\ResourceEntityInterface');
$defaultMutator = Stub::makeEmpty('GoIntegro\\Hateoas\\Entity\\MutatorInterface', ['create' => Stub::never()]);
$userMutator = Stub::makeEmpty('GoIntegro\\Hateoas\\Entity\\MutatorInterface', ['create' => Stub::once()]);
$mutator = new Mutator();
$mutator->addMutator($defaultMutator, Mutator::DEFAULT_MUTATOR)->addMutator($userMutator, 'users');
/* When... (Action) */
$entity = $mutator->update($params, $entity, [], []);
/* Then... (Assertions) */
}
示例4: matcherProvider
public static function matcherProvider()
{
return array(array(0, Stub::never()), array(1, Stub::once()), array(2, Stub::atLeastOnce()), array(3, Stub::exactly(3)), array(1, Stub::once(function () {
return true;
}), true), array(2, Stub::atLeastOnce(function () {
return array();
}), array()), array(1, Stub::exactly(1, function () {
return null;
}), null), array(1, Stub::exactly(1, function () {
return 'hello world!';
}), 'hello world!'));
}
示例5: testSaveUpdate
public function testSaveUpdate()
{
$this->testSaveInsert();
$stub_record = Stub::makeEmptyExcept('Comment', 'save', ['tableName' => function () {
return 'comment';
}, 'beforeSave' => Stub::once(function () {
return true;
}), 'beforeInsert' => Stub::never(function () {
return true;
}), 'afterInsert' => Stub::never(function () {
return true;
}), 'afterSave' => Stub::once(function () {
return true;
}), 'beforeUpdate' => Stub::once(function () {
return true;
}), 'afterUpdate' => Stub::once(function () {
return true;
}), 'getColumns' => function () {
return ['id', 'username', 'post_id'];
}]);
$stub_record->id = 1;
$stub_record->username = 'testuser2';
$stub_record->post_id = 1;
$result = $stub_record->save();
$this->assertSame('testuser2', $stub_record->username);
$this->assertTrue(is_numeric($stub_record->id));
$this->assertTrue($result);
}