当前位置: 首页>>代码示例>>PHP>>正文


PHP Stub::never方法代码示例

本文整理汇总了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) */
 }
开发者ID:gointegro,项目名称:hateoas,代码行数:12,代码来源:BuilderTest.php

示例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) */
 }
开发者ID:gointegro,项目名称:hateoas,代码行数:13,代码来源:DeleterTest.php

示例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) */
 }
开发者ID:gointegro,项目名称:hateoas,代码行数:13,代码来源:MutatorTest.php

示例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!'));
 }
开发者ID:hitechdk,项目名称:Codeception,代码行数:12,代码来源:StubTest.php

示例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);
 }
开发者ID:arduanov,项目名称:simple-record,代码行数:28,代码来源:SimpleRecordTest.php


注:本文中的Codeception\Util\Stub::never方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。