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


PHP Util\Stub类代码示例

本文整理汇总了PHP中Codeception\Util\Stub的典型用法代码示例。如果您正苦于以下问题:PHP Stub类的具体用法?PHP Stub怎么用?PHP Stub使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Stub类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCreateInstanceWithRingPHP

 public function testCreateInstanceWithRingPHP()
 {
     $log = $trace = Stub::make('\\Monolog\\Logger', []);
     $ringphp_handler = Stub::make('WyriHaximus\\React\\RingPHP\\HttpClientAdapter');
     $connection = new Guzzle5Connection(['host' => 'localhost', 'port' => 9200, 'ringphp_handler' => $ringphp_handler], null, $log, $trace);
     $this->assertInstanceOf('Iwai\\Elasticsearch\\Guzzle5Connection', $connection);
 }
开发者ID:iwai,项目名称:elasticsearch-guzzle5connection,代码行数:7,代码来源:Guzzle5ConnectionTest.php

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

示例3: makeTest

 protected function makeTest()
 {
     return Stub::makeEmpty(
         '\Codeception\TestCase\Cept',
         array('dispatcher' => Stub::makeEmpty('Symfony\Component\EventDispatcher\EventDispatcher'))
     );
 }
开发者ID:hendryguna,项目名称:laravel-basic,代码行数:7,代码来源:FacebookTest.php

示例4: testHaveAndSeeInDatabase

 public function testHaveAndSeeInDatabase()
 {
     $this->module->haveInDatabase('users', array('name' => 'john'));
     $this->module->seeInDatabase('users', array('name' => 'john'));
     $this->module->_before(\Codeception\Util\Stub::make('\\Codeception\\TestCase'));
     $this->module->dontSeeInDatabase('users', array('name' => 'john'));
 }
开发者ID:pfz,项目名称:codeception,代码行数:7,代码来源:DbTest.php

示例5: makeTestCase

 protected function makeTestCase($file, $name = '')
 {
     return Stub::make('\Codeception\Lib\DescriptiveTestCase', [
             'getReportFields' => ['file' => codecept_root_dir() . $file],
             'getName' => $name]
     );
 }
开发者ID:Vrian7ipx,项目名称:cascadadev,代码行数:7,代码来源:GroupManagerTest.php

示例6: constructDumbGenericCLI

 public function constructDumbGenericCLI($params = array(), $override = array())
 {
     $defaultParams = array('namespace' => 'DumbExtension', 'type' => 'cli');
     $defaultOverride = array();
     $instance = Stub::construct('\\Alledia\\Framework\\Joomla\\Extension\\Generic', array_merge($defaultParams, $params), array_merge($defaultOverride, $override));
     return $instance;
 }
开发者ID:lepca,项目名称:AllediaFramework,代码行数:7,代码来源:ExtensionsGenericHelper.php

示例7: makeCommand

 protected function makeCommand($className, $saved = true, $extraMethods = [])
 {
     if (!$this->config) {
         $this->config = [];
     }
     $self = $this;
     $mockedMethods = ['save' => function ($file, $output) use($self, $saved) {
         if (!$saved) {
             return false;
         }
         $self->filename = $file;
         $self->content = $output;
         $self->log[] = ['filename' => $file, 'content' => $output];
         $self->saved[$file] = $output;
         return true;
     }, 'getGlobalConfig' => function () use($self) {
         return $self->config;
     }, 'getSuiteConfig' => function () use($self) {
         return $self->config;
     }, 'buildPath' => function ($path, $testName) {
         $path = rtrim($path, DIRECTORY_SEPARATOR);
         $testName = str_replace(['/', '\\'], [DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR], $testName);
         return pathinfo($path . DIRECTORY_SEPARATOR . $testName, PATHINFO_DIRNAME) . DIRECTORY_SEPARATOR;
     }, 'getSuites' => function () {
         return ['shire'];
     }, 'getApplication' => function () {
         return new \Codeception\Util\Maybe();
     }];
     $mockedMethods = array_merge($mockedMethods, $extraMethods);
     $this->command = Stub::construct($className, [$this->commandName], $mockedMethods);
 }
开发者ID:solutionDrive,项目名称:Codeception,代码行数:31,代码来源:BaseCommandRunner.php

示例8: testDispatchMethod

 public function testDispatchMethod()
 {
     $separator = Storage::$separator;
     $method = self::getPrivateMethod('dispatch');
     $structure = $method->invoke(Stub::make(self::$class), "base{$separator}inner{$separator}key");
     $this->assertEquals($structure, array('base', 'inner', 'key'), 'Parsing of the passed path is failed');
 }
开发者ID:zhikiri,项目名称:storage,代码行数:7,代码来源:StorageTest.php

示例9: create

 /**
  * @return Client
  */
 private static function create()
 {
     /** @var Delivery $delivery */
     $delivery = Stub::make('ArchiDelivery\\Delivery');
     $client = new Client($delivery);
     return $client;
 }
开发者ID:stee1cat,项目名称:archi-delivery,代码行数:10,代码来源:ClientTest.php

示例10: testParsingASimpleRequest

 public function testParsingASimpleRequest()
 {
     // Given...
     $repository = Stub::makeEmpty('Doctrine\\ORM\\EntityRepository', ['__call' => function ($name) {
         switch ($name) {
             case 'findOneById':
                 return self::AUTHOR_ENTITY;
                 break;
             case 'findById':
                 return self::COMMENT_ENTITIES;
                 break;
         }
     }]);
     $authorRelationship = Stub::makeEmpty('GoIntegro\\Hateoas\\Metadata\\Resource\\ResourceRelationship');
     $commentsRelationship = Stub::makeEmpty('GoIntegro\\Hateoas\\Metadata\\Resource\\ResourceRelationship');
     $relationships = Stub::makeEmpty('GoIntegro\\Hateoas\\Metadata\\Resource\\ResourceRelationships', ['toOne' => ['author' => $authorRelationship], 'toMany' => ['comments' => $commentsRelationship]]);
     $metadata = Stub::makeEmpty('GoIntegro\\Hateoas\\Metadata\\Resource\\ResourceMetadata', ['relationships' => $relationships, 'isToOneRelationship' => TRUE, 'isToManyRelationship' => TRUE]);
     $em = Stub::makeEmpty('Doctrine\\ORM\\EntityManagerInterface', ['getRepository' => $repository]);
     $mm = Stub::makeEmpty('GoIntegro\\Hateoas\\Metadata\\Resource\\MetadataMinerInterface', ['mine' => $metadata]);
     $hydrant = new ResourceLinksHydrant($em, $mm);
     $params = Stub::makeEmpty('GoIntegro\\Hateoas\\JsonApi\\Request\\Params', ['primaryClass' => "HateoasInc\\Bundle\\ExampleBundle\\Entity\\User"]);
     $resourceObject = ['content' => "Meh.", 'links' => ['author' => '5', 'comments' => ['45', '54', '67']]];
     // When...
     $hydrant->hydrate($params, $resourceObject);
     $expected = ['content' => "Meh.", 'links' => ['author' => self::AUTHOR_ENTITY, 'comments' => self::COMMENT_ENTITIES]];
     // Then...
     $this->assertEquals($expected, $resourceObject);
 }
开发者ID:gointegro,项目名称:hateoas,代码行数:28,代码来源:ResourceLinksHydrantTest.php

示例11: testGetHttpClient

 public function testGetHttpClient()
 {
     /** @var \AwesomeMotive\Drip\Token $token */
     $token = Stub::make("\\AwesomeMotive\\Drip\\Token", ['get_accessToken' => '1234']);
     $this->drip->set_token($token);
     $client = $this->drip->get_httpClient();
     $this->assertInstanceOf("\\GuzzleHttp\\Client", $client);
 }
开发者ID:awesomemotive,项目名称:drip,代码行数:8,代码来源:DripTest.php

示例12: test_unserialize_real_serialized_object

 public function test_unserialize_real_serialized_object()
 {
     $user = Stub::make('StdClass', array('username' => 'username', 'email' => 'email@example.com'));
     $so = new SerializedObject(serialize($user));
     $result = $so->unserialize();
     $this->assertEquals($result->username, 'username');
     $this->assertEquals($result->email, 'email@example.com');
 }
开发者ID:tequilarapido,项目名称:php-serialized,代码行数:8,代码来源:SerializedObjectTest.php

示例13: _before

 public function _before()
 {
     //echo "ENV:".getenv('thisTestRun_testIncludePath');
     //die();
     //chdir(getenv('thisTestRun_testIncludePath'));
     //require_once "system/classes/Config.php";
     $this->config = Stub::construct('Config');
 }
开发者ID:careck,项目名称:bendms,代码行数:8,代码来源:ConfigTest-Copy.php

示例14: testDelete

 public function testDelete()
 {
     $file = Stub::construct('\\Uploads\\models\\UploadedFile', ['filePath' => $this->baseTestFileString], ['getOwnerClass' => 'Test', 'getOwnerId' => 2, 'getDirToUpload' => yii::getAlias(implode(DIRECTORY_SEPARATOR, ['@backend', 'web', 'upload']))]);
     $file->save();
     $filePath = $file->fullPath;
     $file->delete();
     $this->assertFalse(file_exists($filePath));
 }
开发者ID:Vlsirko,项目名称:yii2-uploads,代码行数:8,代码来源:UploadedFileTest.php

示例15: testHaveAndSeeInDatabase

 public function testHaveAndSeeInDatabase()
 {
     $user_id = $this->module->haveInDatabase('users', array('name' => 'john', 'email' => 'john@jon.com'));
     $this->assertInternalType('integer', $user_id);
     $this->module->seeInDatabase('users', array('name' => 'john', 'email' => 'john@jon.com'));
     $this->module->_after(\Codeception\Util\Stub::make('\Codeception\TestCase'));
     $this->module->dontSeeInDatabase('users', array('name' => 'john'));
 }
开发者ID:hendryguna,项目名称:laravel-basic,代码行数:8,代码来源:DbTest.php


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