本文整理汇总了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);
}
示例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"/');
}
示例3: setUp
public function setUp()
{
$this->serviceManager = ServiceManagerFactory::getServiceManager();
/* @var $application \Zend\Mvc\Application */
$application = $this->serviceManager->get('Application');
$application->bootstrap();
}
示例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'));
}
示例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);
}
示例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);
}
示例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());
}
示例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));
}
示例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());
}
示例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.");
}
}
示例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']);
}
}
示例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);
}
示例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));
}
示例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));
}
示例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'));
}