本文整理汇总了PHP中Prophecy\Prophet::prophesize方法的典型用法代码示例。如果您正苦于以下问题:PHP Prophet::prophesize方法的具体用法?PHP Prophet::prophesize怎么用?PHP Prophet::prophesize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prophecy\Prophet
的用法示例。
在下文中一共展示了Prophet::prophesize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prophesize
/**
* @param string|null $classOrInterface
* @return \Prophecy\Prophecy\ObjectProphecy
* @throws \LogicException
*/
protected function prophesize($classOrInterface = null)
{
if (null === $this->prophet) {
throw new \LogicException(sprintf('The setUp method of %s must be called to initialize Prophecy.', __CLASS__));
}
return $this->prophet->prophesize($classOrInterface);
}
示例2: getAnnotationsExtractorResults
protected function getAnnotationsExtractorResults()
{
$extractorResultProphecy = $this->prophet->prophesize('Team3\\PayU\\PropertyExtractor\\ExtractorResult');
$extractorResultProphecy->getPropertyName()->willReturn($this->getPropertyName());
$extractorResultProphecy->getValue()->willReturn($this->getValue());
return [$extractorResultProphecy];
}
示例3: createBinary
/**
* Create a binary mock.
*
* @param $name
* @param $supported
* @param $exists
*/
public function createBinary($name, $supported, $exists)
{
$binary = $this->prophet->prophesize('Peridot\\WebDriverManager\\Binary\\BinaryInterface');
$binary->isSupported()->willReturn($supported);
$binary->getName()->willReturn($name);
$binary->exists(Argument::any())->willReturn($exists);
return $binary;
}
示例4: mockFlashMessenger
/**
* Mock the flashmessenger
*
* @param $flashMessenger
*/
protected function mockFlashMessenger($flashMessenger)
{
$prophet = new Prophet();
$serviceManager = $prophet->prophesize('\\Zend\\ServiceManager\\ServiceManager');
$pluginManager = $prophet->prophesize('\\Zend\\Mvc\\Controller\\PluginManager');
$serviceManager->get('ControllerPluginManager')->willReturn($pluginManager);
$pluginManager->get('flashmessenger')->willReturn($flashMessenger->getWrappedObject());
$this->createService($serviceManager);
}
示例5: it_should_not_replace_request_param_if_format_is_not_supported
public function it_should_not_replace_request_param_if_format_is_not_supported()
{
$requestParam = $this->prophet->prophesize('Symfony\\Component\\HttpFoundation\\ParameterBag');
$request = Request::create('/');
$request->request = $requestParam->reveal();
$requestParam->replace(Argument::any())->shouldNotBeCalled();
$this->decoderProvider->supports(Argument::any())->willReturn(false);
$this->__invoke($request);
}
示例6: 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());
}
示例7: setUp
public function setUp()
{
unset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']);
$prophet = new Prophet();
$this->packageManagerProphecy = $prophet->prophesize(PackageManager::class);
$this->dbProphecy = $prophet->prophesize(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
$GLOBALS['TYPO3_DB'] = $this->dbProphecy->reveal();
$this->updateWizard = new UpdateWizard();
ExtensionManagementUtility::setPackageManager($this->packageManagerProphecy->reveal());
}
示例8: setUp
/**
*
*/
protected function setUp()
{
$prophet = new Prophet();
$this->prophet = $prophet;
$this->formatter = $this->prophet->prophesize(FormatterInterface::class);
$this->writer = $this->prophet->prophesize(WriterInterface::class);
$this->dumper = new Dumper();
$this->dumper->setFormatter($this->formatter->reveal());
$this->dumper->setWriter($this->writer->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->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());
}
示例10: it_can_match_repeating_multiple_segments
public function it_can_match_repeating_multiple_segments()
{
$prophet = new Prophet();
$httpProphecy = $prophet->prophesize('Zend\\Uri\\Http');
$httpProphecy->getPath()->willReturn('/a/foo/bar/b/c/bar/bass/d');
$requestProphecy = $prophet->prophesize('Zend\\Http\\PhpEnvironment\\Request');
$requestProphecy->getUri()->willReturn($httpProphecy->reveal());
$this->beConstructedWith('/a[section]/b/c[other_section]/d', ['section' => '/[a-zA-Z][a-zA-Z0-9_-]+', 'other_section' => '/[a-zA-Z][a-zA-Z0-9_-]+'], ['controller' => 'Controller', 'action' => 'create']);
$this->match($requestProphecy->reveal())->shouldReturnAnInstanceOf('Zend\\Mvc\\Router\\Http\\RouteMatch');
}
示例11: 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->annotationResourceOption = $this->prophet->prophesize('SDispatcher\\Common\\AnnotationResourceOption');
$this->route->getOption(RouteOptions::REST)->willReturn(true);
$this->routes->get(Argument::any())->willReturn($this->route->reveal());
$this->beConstructedWith($this->routes->reveal(), $this->annotationResourceOption->reveal());
}
示例12: Prophet
function it_matches_a_belongs_to_many_relationship()
{
$p = new Prophet();
$related = $p->prophesize('PhpSpec\\Laravel\\Test\\Example');
$belongsTo = $p->prophesize('Illuminate\\Database\\Eloquent\\Relations\\BelongsToMany');
$belongsTo->getRelated()->willReturn($related->reveal());
$this->positiveMatch('name', $belongsTo->reveal(), array('belongsToMany', 'PhpSpec\\Laravel\\Test\\Example'));
$this->shouldThrow('PhpSpec\\Exception\\Example\\FailureException')->during('positiveMatch', array('name', $belongsTo->reveal(), array('belongsToMany', 'PhpSpec\\Laravel\\Test\\OtherExample')));
$this->negativeMatch('name', $belongsTo->reveal(), array('belongsToMany', 'PhpSpec\\Laravel\\Test\\OtherExample'));
$this->shouldThrow('PhpSpec\\Exception\\Example\\FailureException')->during('negativeMatch', array('name', $belongsTo->reveal(), array('belongsToMany', 'PhpSpec\\Laravel\\Test\\Example')));
}
示例13: testRootEntity
/**
* Test Create, Endpoint, Get/Set methods.
*/
public function testRootEntity()
{
$root = Root::create();
$this->assertInstanceOf('Shoko\\TwitchApiBundle\\Model\\Entity\\Root', $root);
$this->assertEquals(null, $root->getToken());
$token = $this->prophet->prophesize('Shoko\\TwitchApiBundle\\Model\\ValueObject\\Token');
$this->assertEquals($token->reveal(), $root->setToken($token->reveal())->getToken());
$this->assertEquals(array(), $root->getLinks());
$link = 'some_link';
$this->assertEquals([$link], $root->setLinks([$link])->getLinks());
}
示例14: testNoopNext
public function testNoopNext()
{
$prophet = new Prophet();
$reqProphecy = $prophet->prophesize(ServerRequestInterface::class);
$resProphecy = $prophet->prophesize(ResponseInterface::class);
$req = $reqProphecy->reveal();
$res = $resProphecy->reveal();
/** @noinspection PhpParamsInspection */
$returnValue = NimoUtility::noopNext($req, $res);
$this->assertSame($res, $returnValue);
}
示例15: createMissingCollabolators
/**
* @param CollaboratorManager $collaborators
* @param \ReflectionMethod $beforeMethod
*/
private function createMissingCollabolators(CollaboratorManager $collaborators, \ReflectionMethod $beforeMethod)
{
foreach ($beforeMethod->getParameters() as $parameter) {
if (!$collaborators->has($parameter->getName())) {
$collaborator = new Collaborator($this->prophet->prophesize());
if (null !== ($class = $parameter->getClass())) {
$collaborator->beADoubleOf($class->getName());
}
$collaborators->set($parameter->getName(), $collaborator);
}
}
}