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


PHP Stub::makeEmpty方法代码示例

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


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

示例1: 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

示例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: testIsCloudflareRequest

 public function testIsCloudflareRequest()
 {
     $tests = [[Stub::makeEmpty(RequestAdapter::class, ['getRemoteAddr' => '103.21.244.2', 'getHeaders' => ['cf-connecting-ip' => '127.0.0.1']]), true], [Stub::makeEmpty(RequestAdapter::class, ['getRemoteAddr' => '103.22.200.1', 'getHeaders' => ['cf-connecting-ip' => '127.0.0.1']]), true], [Stub::makeEmpty(RequestAdapter::class, ['getRemoteAddr' => '103.21.243.2', 'getHeaders' => ['cf-connecting-ip' => '127.0.0.1']]), false], [Stub::makeEmpty(RequestAdapter::class, ['getRemoteAddr' => '103.21.244.2', 'getHeaders' => ['custom-ip' => '127.0.0.1']]), false]];
     foreach ($tests as $testData) {
         list($request, $result) = $testData;
         $this->assertEquals($result, (new CloudflareDetector($this->ipAddresses, $request))->isCloudflareRequest());
     }
 }
开发者ID:foowie,项目名称:cloudflare-detection,代码行数:8,代码来源:CloudflareDetectorTest.php

示例5: testBeforeHookResetsVariables

 public function testBeforeHookResetsVariables()
 {
     $this->module->haveHttpHeader('Origin', 'http://www.example.com');
     $this->module->sendGET('/rest/user/');
     $this->assertEquals('http://www.example.com', $this->module->client->getServerParameter('HTTP_ORIGIN'));
     $this->module->_before(Stub::makeEmpty('\\Codeception\\TestCase\\Cest'));
     $this->assertNull($this->module->client->getServerParameter('HTTP_ORIGIN', null));
 }
开发者ID:corcre,项目名称:elabftw,代码行数:8,代码来源:RestTest.php

示例6: setUp

 public function setUp()
 {
     $this->module = new \Codeception\Module\SOAP(make_container());
     $this->module->_setConfig(array('schema' => 'http://www.w3.org/2001/xml.xsd', 'endpoint' => 'http://codeception.com/api/wsdl'));
     $this->layout = \Codeception\Configuration::dataDir() . '/xml/layout.xml';
     $this->module->isFunctional = true;
     $this->module->_before(Stub::makeEmpty('\\Codeception\\Test\\Test'));
     $this->module->client = Stub::makeEmpty('\\Codeception\\Lib\\Connector\\Universal');
 }
开发者ID:foxman209,项目名称:Codeception,代码行数:9,代码来源:SoapTest.php

示例7: setUp

 public function setUp()
 {
     $this->module = new \Codeception\Module\REST();
     $connector = new \Codeception\Util\Connector\Universal();
     $connector->setIndex(\Codeception\Configuration::dataDir() . '/rest/index.php');
     $this->module->client = $connector;
     $this->module->_before(Stub::makeEmpty('\\Codeception\\TestCase\\Cest'));
     $this->module->client->setServerParameters(array('SCRIPT_FILENAME' => 'index.php', 'SCRIPT_NAME' => 'index', 'SERVER_NAME' => 'localhost', 'SERVER_PROTOCOL' => 'http'));
 }
开发者ID:pfz,项目名称:codeception,代码行数:9,代码来源:RestTest.php

示例8: testMakeEmptyMethodReplaced

 public function testMakeEmptyMethodReplaced()
 {
     $dummy = Stub::makeEmpty('DummyClass', array('helloWorld' => function () {
         return 'good bye world';
     }));
     $this->assertTrue(method_exists($dummy, 'helloWorld'));
     $this->assertNotEquals($this->dummy->helloWorld(), $dummy->helloWorld());
     $this->assertEquals($dummy->helloWorld(), 'good bye world');
 }
开发者ID:BatVane,项目名称:Codeception,代码行数:9,代码来源:StubTest.php

示例9: setUp

 public function setUp()
 {
     $this->dispatcher = new Symfony\Component\EventDispatcher\EventDispatcher();
     $settings = \Codeception\Configuration::$defaultSuiteSettings;
     $settings['class_name'] = 'CodeGuy';
     $this->suiteman = new \Codeception\SuiteManager($this->dispatcher, 'suite', $settings);
     $printer = \Codeception\Util\Stub::makeEmpty('PHPUnit_TextUI_ResultPrinter');
     $this->runner = new \Codeception\PHPUnit\Runner();
     $this->runner->setPrinter($printer);
 }
开发者ID:kansey,项目名称:yii2albom,代码行数:10,代码来源:SuiteManagerTest.php

示例10: testCheckingFreshnessOfCache

 public function testCheckingFreshnessOfCache()
 {
     // Given...
     $kernel = Stub::makeEmpty('Symfony\\Component\\HttpKernel\\KernelInterface', ['isDebug' => TRUE]);
     $cache = new RamlDocSymfonyCache($kernel);
     // When...
     $isFresh = $cache->isFresh();
     // Then...
     $this->assertFalse($isFresh);
 }
开发者ID:mb3rnard,项目名称:hateoas-bundle,代码行数:10,代码来源:RamlDocSymfonyCacheTest.php

示例11: generateFilename

 public function generateFilename(CodeGuy $I)
 {
     $I->haveFakeClass($stub = Stub::make($this->class, array('test' => Stub::makeEmpty('\\Codeception\\TestCase\\Cept', array('getFileName' => function () {
         return 'testtest';
     })))));
     $I->executeTestedMethod($stub);
     $I->seeResultEquals(\Codeception\Configuration::logDir() . 'debug' . DIRECTORY_SEPARATOR . 'testtest - 1');
     $I->executeTestedMethod($stub, 'mytest');
     $I->seeResultEquals(\Codeception\Configuration::logDir() . 'debug' . DIRECTORY_SEPARATOR . 'testtest - 2 - mytest');
 }
开发者ID:pfz,项目名称:codeception,代码行数:10,代码来源:WebDebugCest.php

示例12: setUp

 public function setUp()
 {
     $this->module = new \Codeception\Module\Queue(make_container());
     $this->module->_setConfig($this->config);
     $this->module->_before(Stub::makeEmpty('\\Codeception\\TestCase'));
     try {
         $this->module->clearQueue('default');
     } catch (\Pheanstalk_Exception_ConnectionException $e) {
         $this->markTestSkipped("Beanstalk is not running");
     }
 }
开发者ID:foxman209,项目名称:Codeception,代码行数:11,代码来源:Beanstalkd_Test.php

示例13: testBeforeHookResetsVariables

 public function testBeforeHookResetsVariables()
 {
     $this->module->haveHttpHeader('Origin', 'http://www.example.com');
     $this->module->sendGET('/rest/user/');
     $server = $this->module->client->getInternalRequest()->getServer();
     $this->assertArrayHasKey('HTTP_ORIGIN', $server);
     $this->module->_before(Stub::makeEmpty('\\Codeception\\Test\\Test'));
     $this->module->sendGET('/rest/user/');
     $server = $this->module->client->getInternalRequest()->getServer();
     $this->assertArrayNotHasKey('HTTP_ORIGIN', $server);
 }
开发者ID:solutionDrive,项目名称:Codeception,代码行数:11,代码来源:RestTest.php

示例14: setUp

 public function setUp()
 {
     $this->phpBrowser = new \Codeception\Module\PhpBrowser();
     $url = 'http://localhost:8010';
     $this->phpBrowser->_setConfig(array('url' => $url));
     $this->phpBrowser->_initialize();
     $this->module = Stub::make('\\Codeception\\Module\\REST', ['getModules' => [$this->phpBrowser]]);
     $this->module->_initialize();
     $this->module->_before(Stub::makeEmpty('\\Codeception\\TestCase\\Cest'));
     $this->phpBrowser->_before(Stub::makeEmpty('\\Codeception\\TestCase\\Cest'));
 }
开发者ID:nhemnhem,项目名称:learning_test,代码行数:11,代码来源:PhpBrowserRestTest.php

示例15: testFindingInlineBodySchema

 /**
  * @depends testNavigatingARaml
  */
 public function testFindingInlineBodySchema()
 {
     /* Given... (Fixture) */
     $jsonCoder = Stub::makeEmpty('GoIntegro\\Json\\JsonCoder');
     $ramlDoc = Stub::makeEmpty('GoIntegro\\Raml\\RamlDoc', ['rawRaml' => Yaml::parse(__DIR__ . self::INLINE_BODY_SCHEMA_RAML), 'schemas' => Stub::makeEmpty('GoIntegro\\Raml\\Root\\MapCollection')]);
     $navigator = new DocNavigator($ramlDoc, $jsonCoder);
     /* When... (Action) */
     $schema = $navigator->findRequestSchema(RamlSpec::HTTP_POST, '/some-resources');
     /* Then... (Assertions) */
     $this->assertEquals(self::INLINE_BODY_SCHEMA, $schema);
 }
开发者ID:gointegro,项目名称:raml,代码行数:14,代码来源:DocNavigatorTest.php


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