當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。