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


PHP PHPUnit_Framework_MockObject_MockObject::get方法代码示例

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


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

示例1: testGet

 public function testGet()
 {
     $actionInterfaceMock = $this->getMockForAbstractClass('Magento\\Indexer\\Model\\ActionInterface', [], '', false);
     $this->objectManagerMock->expects($this->once())->method('get')->with('Magento\\Indexer\\Model\\ActionInterface')->will($this->returnValue($actionInterfaceMock));
     $this->model->get('Magento\\Indexer\\Model\\ActionInterface');
     $this->assertInstanceOf('Magento\\Indexer\\Model\\ActionInterface', $actionInterfaceMock);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:7,代码来源:ActionFactoryTest.php

示例2: testShouldWriteLoadedUrlToLogEvenWithDisabledDebugMode

 public function testShouldWriteLoadedUrlToLogEvenWithDisabledDebugMode()
 {
     $this->setDebugMode(false);
     // Make debug mode disabled
     $this->driver->get('http://foo.bar');
     $this->expectOutputRegex('/.*\\[WebDriver\\] Loading URL "http:\\/\\/foo.bar"/');
 }
开发者ID:mhujer,项目名称:steward,代码行数:7,代码来源:RemoteWebDriverTest.php

示例3: setUp

 public function setUp()
 {
     $this->serviceManager = ServiceManagerFactory::getServiceManager();
     /* @var $application \Zend\Mvc\Application */
     $application = $this->serviceManager->get('Application');
     $application->bootstrap();
 }
开发者ID:ck-developer,项目名称:omnipay-module,代码行数:7,代码来源:TestCase.php

示例4: testUnwrappingGet

 public function testUnwrappingGet()
 {
     $unencryptedValue = 'foobar';
     $encryptedValue = $this->crypto->encrypt($unencryptedValue);
     $this->wrappedSession->expects($this->once())->method('get')->with('encrypted_session_data')->willReturnCallback(function () use($encryptedValue) {
         return $encryptedValue;
     });
     $this->assertSame($unencryptedValue, $this->wrappedSession->get('encrypted_session_data'));
 }
开发者ID:evanjt,项目名称:core,代码行数:9,代码来源:cryptowrappingtest.php

示例5: testCacheSet

 /**
  * @test
  */
 public function testCacheSet()
 {
     $token = $this->tokenProvider->getAccessTokenByToken('nnch734d00sl2jdk');
     $serializedToken = serialize($token);
     $key = 'tokenProvider/token/key:nnch734d00sl2jdk';
     $this->tokenProviderCache->cacheSet($key, $serializedToken);
     $cachedToken = $this->client->get($key);
     $this->assertEquals($serializedToken, $cachedToken);
 }
开发者ID:cultuurnet,项目名称:symfony-security-oauth-redis,代码行数:12,代码来源:TokenProviderCacheTest.php

示例6: testGet

 /**
  * @param array  $composerData
  * @param array  $packages
  * @param string $repoUrl
  *
  * @dataProvider getDataProvider
  */
 public function testGet(array $composerData, array $packages, $repoUrl)
 {
     $version = 'mockVersion';
     $this->_infoEndpoint->expects($this->exactly(1))->method('_getGitVersion')->will($this->returnValue($version));
     $this->_infoEndpoint->expects($this->exactly(1))->method('_loadComposerFile')->will($this->returnValue($composerData));
     $this->_infoEndpoint->expects($this->exactly(1))->method('_getRepoUrl')->with($this->equalTo($version))->will($this->returnValue($repoUrl));
     $expected = new DataObject(array(), array('repoUrl' => $repoUrl, 'version' => 'mockVersion', 'packages' => $packages));
     $actual = $this->_infoEndpoint->get();
     $this->assertEquals($expected, $actual);
 }
开发者ID:bigpoint,项目名称:slim-bootstrap,代码行数:17,代码来源:InfoTest.php

示例7: testGetMenuProviderOnTopOptions

 /**
  * @param array $adminGroupsOnTopOption
  *
  * @dataProvider getAdminGroupsWithOnTopOption
  */
 public function testGetMenuProviderOnTopOptions(array $adminGroupsOnTopOption)
 {
     $this->pool->expects($this->once())->method('getInstance')->with($this->equalTo('sonata_admin_foo_service'))->will($this->returnValue($this->getAdminMock(true, false)));
     $menu = $this->provider->get('providerFoo', array('name' => 'foo', 'group' => $adminGroupsOnTopOption));
     $this->assertInstanceOf('Knp\\Menu\\ItemInterface', $menu);
     $this->assertCount(0, $menu->getChildren());
 }
开发者ID:robhunt3r,项目名称:SonataAdminBundle,代码行数:12,代码来源:GroupMenuProviderTest.php

示例8: testGet

 /**
  * @covers ::set
  * @covers ::get
  */
 public function testGet()
 {
     $name = 'id';
     $value = $this->randomMachineName();
     $this->assertSame($this->id, $this->entity->get($name));
     $this->assertSame($this->entity, $this->entity->set($name, $value));
     $this->assertSame($value, $this->entity->get($name));
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:12,代码来源:ConfigEntityBaseUnitTest.php

示例9: testCreateWithCustomIgnoreSection

 public function testCreateWithCustomIgnoreSection()
 {
     $extra = array('custom-ignore-files' => array('foo-asset/foo' => array('PATTERN'), 'foo-asset/bar' => array()));
     $this->rootPackage->expects($this->any())->method('getExtra')->will($this->returnValue($extra));
     $manager = IgnoreFactory::create($this->composer, $this->package, null, 'custom-ignore-files');
     $this->assertTrue($manager->isEnabled());
     $this->assertTrue($manager->hasPattern());
     $this->validateInstallDir($manager, $this->config->get('vendor-dir') . '/' . $this->package->getName());
 }
开发者ID:stefangr,项目名称:composer-asset-plugin,代码行数:9,代码来源:IgnoreFactoryTest.php

示例10: assertRenderCacheItem

 /**
  * Asserts a render cache item.
  *
  * @param string $cid
  *   The expected cache ID.
  * @param mixed $data
  *   The expected data for that cache ID.
  * @param string $bin
  *   The expected cache bin.
  */
 protected function assertRenderCacheItem($cid, $data, $bin = 'render') {
   $cache_backend = $this->cacheFactory->get($bin);
   $cached = $cache_backend->get($cid);
   $this->assertNotFalse($cached, sprintf('Expected cache item "%s" exists.', $cid));
   if ($cached !== FALSE) {
     $this->assertEquals($data, $cached->data, sprintf('Cache item "%s" has the expected data.', $cid));
     $this->assertSame(Cache::mergeTags($data['#cache']['tags'], ['rendered']), $cached->tags, "The cache item's cache tags also has the 'rendered' cache tag.");
   }
 }
开发者ID:komejo,项目名称:article-test,代码行数:19,代码来源:RendererTestBase.php

示例11: testProxyAuthenticate

 /**
  * Test proxy authentication to a service.
  *
  * @covers ::proxyAuthenticate
  * @covers ::getServerProxyURL
  * @covers ::parseProxyTicket
  *
  * @dataProvider proxyAuthenticateDataProvider
  */
 public function testProxyAuthenticate($target_service, $cookie_domain, $already_proxied)
 {
     // Set up the fake pgt in the session.
     $this->session->set('cas_pgt', $this->randomMachineName(24));
     // Set up properties so the http client callback knows about them.
     $cookie_value = $this->randomMachineName(24);
     if ($already_proxied) {
         // Set up the fake session data.
         $session_cas_proxy_helper[$target_service][] = array('Name' => 'SESSION', 'Value' => $cookie_value, 'Domain' => $cookie_domain);
         $this->session->set('cas_proxy_helper', $session_cas_proxy_helper);
         $httpClient = new Client();
         $casHelper = $this->getMockBuilder('\\Drupal\\cas\\Service\\CasHelper')->disableOriginalConstructor()->getMock();
         $casProxyHelper = new CasProxyHelper($httpClient, $casHelper, $this->session);
         $jar = $casProxyHelper->proxyAuthenticate($target_service);
         $cookie_array = $jar->toArray();
         $this->assertEquals('SESSION', $cookie_array[0]['Name']);
         $this->assertEquals($cookie_value, $cookie_array[0]['Value']);
         $this->assertEquals($cookie_domain, $cookie_array[0]['Domain']);
     } else {
         $proxy_ticket = $this->randomMachineName(24);
         $xml_response = "<cas:serviceResponse xmlns:cas='http://example.com/cas'>\n           <cas:proxySuccess>\n             <cas:proxyTicket>PT-{$proxy_ticket}</cas:proxyTicket>\n            </cas:proxySuccess>\n         </cas:serviceResponse>";
         $mock = new MockHandler([new Response(200, [], $xml_response), new Response(200, ['Content-type' => 'text/html', 'Set-Cookie' => 'SESSION=' . $cookie_value])]);
         $handler = HandlerStack::create($mock);
         $httpClient = new Client(['handler' => $handler]);
         $casHelper = $this->getMockBuilder('\\Drupal\\cas\\Service\\CasHelper')->disableOriginalConstructor()->getMock();
         $casProxyHelper = new CasProxyHelper($httpClient, $casHelper, $this->session);
         // The casHelper expects to be called for a few things.
         $casHelper->expects($this->once())->method('getServerBaseUrl')->will($this->returnValue('https://example.com/cas/'));
         $casHelper->expects($this->once())->method('isProxy')->will($this->returnValue(TRUE));
         $jar = $casProxyHelper->proxyAuthenticate($target_service);
         $this->assertEquals('SESSION', $this->session->get('cas_proxy_helper')[$target_service][0]['Name']);
         $this->assertEquals($cookie_value, $this->session->get('cas_proxy_helper')[$target_service][0]['Value']);
         $this->assertEquals($cookie_domain, $this->session->get('cas_proxy_helper')[$target_service][0]['Domain']);
         $cookie_array = $jar->toArray();
         $this->assertEquals('SESSION', $cookie_array[0]['Name']);
         $this->assertEquals($cookie_value, $cookie_array[0]['Value']);
         $this->assertEquals($cookie_domain, $cookie_array[0]['Domain']);
     }
 }
开发者ID:pulibrary,项目名称:recap,代码行数:48,代码来源:CasProxyHelperTest.php

示例12: testGet

 /**
  * @param string $k
  * @param mixed $v
  * @dataProvider providerGet
  * @depends testSet
  */
 public function testGet($k, $v)
 {
     $this->mail->set($k, $v);
     $result = $this->mail->get($k);
     $this->assertEquals($v, $result);
 }
开发者ID:rosstimson,项目名称:revolution,代码行数:12,代码来源:modMailTest.php

示例13: testGetMethodThrowsExceptionWhenStrategyReturnsNonEntity

 /**
  * @dataProvider strategyProviderInvalidReturnValues
  * @expectedException \Doctrine\ORM\EntityNotFoundException
  */
 public function testGetMethodThrowsExceptionWhenStrategyReturnsNonEntity($returnValue)
 {
     $this->strategyProvider->expects($this->once())->method('get')->will($this->returnValue($returnValue));
     $this->assertInstanceOf('Obiz\\Common\\Entity', $this->entityRepository->get(1));
 }
开发者ID:obiz,项目名称:common,代码行数:9,代码来源:EntityRepositoryTest.php

示例14: testGet

 /**
  * @param string $url
  * @param \GuzzleHttp\Psr7\Response $response
  * @param array $params
  * @param array $expectedRequestParams
  * @param array|int $result
  * @dataProvider getDataProvider
  */
 public function testGet($url, $response, $params, $expectedRequestParams, $result)
 {
     $this->clientMock->expects($this->once())->method('get')->with($url, $expectedRequestParams)->willReturn($response);
     $this->assertEquals($result, $this->httpMock->get($url, $params));
 }
开发者ID:subscribepro,项目名称:subscribepro-php,代码行数:13,代码来源:HttpTest.php

示例15: testGetMethodWhenDrupalProviderReturnsNonEntity

 public function testGetMethodWhenDrupalProviderReturnsNonEntity()
 {
     $this->concreteDrupalProvider->expects($this->once())->method('nodeToEntity')->will($this->returnValue(false));
     $this->assertFalse($this->concreteDrupalProvider->get(1, 'Obiz\\Common\\Entity'));
 }
开发者ID:obiz,项目名称:common,代码行数:5,代码来源:DrupalProviderTest.php


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