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