本文整理汇总了PHP中Prophecy\Prophecy\ObjectProphecy::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectProphecy::get方法的具体用法?PHP ObjectProphecy::get怎么用?PHP ObjectProphecy::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prophecy\Prophecy\ObjectProphecy
的用法示例。
在下文中一共展示了ObjectProphecy::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->factory = new RendererFactory();
$this->container = $this->prophesize(ContainerInterface::class);
$this->container->get('translator')->willReturn(Translator::factory([]));
$this->container->get('config')->willReturn(['navigation' => [], 'recaptcha' => []]);
$this->container->get(RouteAssembler::class)->willReturn($this->prophesize(RouteAssembler::class)->reveal());
}
示例2: testAjaxImageUploadForm
public function testAjaxImageUploadForm()
{
$app = $this->prophesize('Zend\\Mvc\\Application');
$app->getMvcEvent()->willReturn($this->prophesize('Zend\\Mvc\\MvcEvent'));
$this->locator->get('Application')->willReturn($app);
$form = $this->ajaxImageUploadFormFactory->createService($this->controllerManager->reveal());
$this->assertInstanceOf('LearnZF2AjaxImageGallery\\Form\\AjaxImageUploadForm', $form);
}
示例3: testReturnIndexControllerFromFactory
public function testReturnIndexControllerFromFactory()
{
$formElementManager = $this->prophesize('Zend\\Form\\FormElementManager');
$ajaxImageUploadForm = $this->prophesize('LearnZF2AjaxImageGallery\\Form\\AjaxImageUploadForm');
$formElementManager->get('LearnZF2AjaxImageGallery\\Form\\AjaxImageUploadForm')->willReturn($ajaxImageUploadForm);
$this->serviceLocator->get('FormElementManager')->willReturn($formElementManager);
$controller = $this->indexControllerFactory->__invoke($this->indexControllerManager->reveal());
$this->assertInstanceOf('LearnZF2AjaxImageGallery\\Controller\\IndexController', $controller);
}
示例4: testThrowsExceptionIfKeyWasNotFound
/**
* @expectedException \PharIo\Phive\DownloadFailedException
*/
public function testThrowsExceptionIfKeyWasNotFound()
{
$response = $this->prophesize(CurlResponse::class);
$response->getHttpCode()->willReturn(404);
$response->getErrorMessage()->willReturn('Not Found');
$this->curl->get(Argument::any(), Argument::any())->willReturn($response);
$downloader = new GnupgKeyDownloader($this->curl->reveal(), [new Url('https://example.com')], $this->output->reveal());
$downloader->download('12345678');
}
示例5: testNormalizeWithNoEntity
/**
* @covers ::normalize
*/
public function testNormalizeWithNoEntity()
{
$entity_reference = $this->prophesize(TypedDataInterface::class);
$entity_reference->getValue()->willReturn(NULL)->shouldBeCalled();
$this->fieldItem->get('entity')->willReturn($entity_reference->reveal())->shouldBeCalled();
$normalized = $this->normalizer->normalize($this->fieldItem->reveal());
$expected = ['target_id' => ['value' => 'test']];
$this->assertSame($expected, $normalized);
}
示例6: testIsGrantedMaskComparison
/**
* @dataProvider isGrantedMaskComparisonProvider
*/
public function testIsGrantedMaskComparison($action, $requiredMask, $mask, $result)
{
$this->maskBuilder->resolveMask(Argument::exact($action))->willReturn($requiredMask);
$this->maskBuilder->get()->willReturn($mask);
if ($result) {
$this->assertTrue($this->permission->isGranted($action));
} else {
$this->assertfalse($this->permission->isGranted($action));
}
}
示例7: let
public function let()
{
$this->prophet = new Prophet();
$this->routes = $this->prophet->prophesize('Symfony\\Component\\Routing\\RouteCollection');
$this->formatNegotiator = $this->prophet->prophesize('FOS\\Rest\\Util\\FormatNegotiator');
$this->route = $this->prophet->prophesize('Symfony\\Component\\Routing\\Route');
$this->route->getOption(RouteOptions::REST)->willReturn(true);
$this->routes->get(Argument::any())->willReturn($this->route->reveal());
$this->beConstructedWith($this->routes->reveal(), $this->formatNegotiator->reveal());
}
示例8: let
public function let()
{
$this->prophet = new Prophet();
$this->route = $this->prophet->prophesize('Symfony\\Component\\Routing\\Route');
$this->routes = $this->prophet->prophesize('Symfony\\Component\\Routing\\RouteCollection');
$this->event = $this->prophet->prophesize('Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent');
$this->route->getOption(RouteOptions::REST)->willReturn(true);
$this->routes->get(Argument::any())->willReturn($this->route->reveal());
$this->beConstructedWith($this->routes->reveal());
}
示例9: let
public function let()
{
$this->prophet = new Prophet();
$this->route = $this->prophet->prophesize('Symfony\\Component\\Routing\\Route');
$this->routes = $this->prophet->prophesize('Symfony\\Component\\Routing\\RouteCollection');
$this->decoderProvider = $this->prophet->prophesize('SDispatcher\\Common\\FOSDecoderProvider');
$this->route->getOption(RouteOptions::REST)->willReturn(true);
$this->routes->get(Argument::any())->willReturn($this->route->reveal());
$this->beConstructedWith($this->routes->reveal(), $this->decoderProvider->reveal());
}
示例10: let
public function let()
{
$this->prophet = new Prophet();
$this->route = $this->prophet->prophesize('Symfony\\Component\\Routing\\Route');
$this->routes = $this->prophet->prophesize('Symfony\\Component\\Routing\\RouteCollection');
$this->response = $this->prophet->prophesize('SDispatcher\\DataResponse');
$this->encoder = $this->prophet->prophesize('Symfony\\Component\\Serializer\\Encoder\\EncoderInterface');
$this->route->getOption(RouteOptions::REST)->willReturn(true);
$this->routes->get(Argument::any())->willReturn($this->route->reveal());
$this->beConstructedWith($this->routes->reveal(), $this->encoder->reveal());
}
示例11: testEnumLabel
public function testEnumLabel()
{
$enum = $this->prophesize('EnumBundle\\Enum\\EnumInterface');
$enum->getChoices()->willReturn(['foo' => 'FOO', 'bar' => 'BAR']);
$this->registry->get('test')->willReturn($enum->reveal());
$twig = $this->createEnvironment();
$this->assertSame('FOO', $twig->createTemplate("{{ 'foo'|enum_label('test') }}")->render([]));
$this->assertSame('BAR', $twig->createTemplate("{{ enum_label('bar', 'test') }}")->render([]));
$this->assertSame('not_exist', $twig->createTemplate("{{ 'not_exist'|enum_label('test') }}")->render([]));
$this->assertSame('not_exist', $twig->createTemplate("{{ enum_label('not_exist', 'test') }}")->render([]));
}
示例12: testGetJsonResponseFailure
/**
* @expectedException \PSU\Exception\HttpClientException
*/
public function testGetJsonResponseFailure()
{
// test values
$url = 'http://foo.com';
//mock methods
$this->responseInterface->getStatusCode()->willReturn(500)->shouldBeCalledTimes(1);
$this->clientInterface->get(Argument::exact($url))->willReturn($this->responseInterface->reveal())->shouldBeCalledTimes(1);
// init object
$guzzlAdapter = new GuzzlApapter($this->clientInterface->reveal());
// test
$this->assertNull($guzzlAdapter->getJsonResponse($url));
}
示例13: testWithConfig
public function testWithConfig()
{
$paths = ['ns1' => [__DIR__ . '/partials'], 'ns2' => [__DIR__ . '/templates']];
$config = ['extension' => 'handlebars', 'separator' => '.', 'paths' => $paths];
$factory = new ResolverFactory();
$this->container->get(HandlebarsRendererFactory::CONFIG_KEY)->willReturn($config);
/* @var AggregateResolver $resolver */
$resolver = $factory($this->container->reveal());
/* @var FilesystemResolver $filesystemResolver */
$filesystemResolver = $resolver->fetchByType(FilesystemResolver::class);
$this->assertEquals('handlebars', $filesystemResolver->getExtension());
$this->assertEquals('.', $filesystemResolver->getSeparator());
$paths = $filesystemResolver->getPaths();
$this->assertArrayHasKey('ns1', $paths);
$this->assertArrayHasKey('ns2', $paths);
}
示例14: _createRepositoryConnector
/**
* Creates repository connector.
*
* @param string $username Username.
* @param string $password Password.
* @param string $last_revision_cache_duration Last revision cache duration.
*
* @return Connector
*/
private function _createRepositoryConnector($username, $password, $last_revision_cache_duration = '10 minutes')
{
$this->_configEditor->get('repository-connector.username')->willReturn($username)->shouldBeCalled();
$this->_configEditor->get('repository-connector.password')->willReturn($password)->shouldBeCalled();
$this->_configEditor->get('repository-connector.last-revision-cache-duration')->willReturn($last_revision_cache_duration)->shouldBeCalled();
return new Connector($this->_configEditor->reveal(), $this->_processFactory->reveal(), $this->_io->reveal(), $this->_cacheManager->reveal(), $this->_revisionListParser->reveal());
}
示例15: processReturnsEmptyStringIfSpecifiedPostProcessorDoesNotImplementTheInterface
/**
* @test
*/
public function processReturnsEmptyStringIfSpecifiedPostProcessorDoesNotImplementTheInterface()
{
$typoScript = array(10 => $this->getUniqueId('postprocess'), 20 => PostProcessorWithoutInterfaceFixture::class);
$this->objectManagerProphecy->get(Argument::cetera())->will(function ($arguments) {
return new $arguments[0]($arguments[1], $arguments[2]);
});
$subject = $this->createSubject($typoScript);
$this->assertEquals('', $subject->process());
}