本文整理汇总了PHP中PHPUnit_Framework_MockObject_MockObject::generate方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_MockObject_MockObject::generate方法的具体用法?PHP PHPUnit_Framework_MockObject_MockObject::generate怎么用?PHP PHPUnit_Framework_MockObject_MockObject::generate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_MockObject_MockObject
的用法示例。
在下文中一共展示了PHPUnit_Framework_MockObject_MockObject::generate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGenerate
public function testGenerate()
{
$schema = ['relationData' => [['field_id' => new FieldConfigId('extend', 'Test\\Entity', ExtendHelper::buildAssociationName('Test\\TargetEntity1', self::ASSOCIATION_KIND), 'manyToOne'), 'target_entity' => 'Test\\TargetEntity1'], ['field_id' => new FieldConfigId('extend', 'Test\\Entity', ExtendHelper::buildAssociationName('Test\\TargetEntity2', self::ASSOCIATION_KIND), 'manyToOne'), 'target_entity' => 'Test\\TargetEntity2'], ['field_id' => new FieldConfigId('extend', 'Test\\Entity', ExtendHelper::buildAssociationName('Test\\TargetEntity3', self::ASSOCIATION_KIND), 'manyToMany'), 'target_entity' => 'Test\\TargetEntity3'], ['field_id' => new FieldConfigId('extend', 'Test\\Entity', 'testField', 'manyToOne'), 'target_entity' => 'Test\\TargetEntity4']]];
$class = PhpClass::create('Test\\Entity');
$this->extension->generate($schema, $class);
$strategy = new DefaultGeneratorStrategy();
$classBody = $strategy->generate($class);
$expectedBody = file_get_contents(__DIR__ . '/../Fixtures/multiple_many_to_one_association.txt');
$this->assertEquals(trim($expectedBody), $classBody);
}
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:MultipleManyToOneAbstractAssociationEntityGeneratorExtensionTest.php
示例2: testGenerateWithTemplateFallbacks
/**
* test generate with a missing template in the chosen template.
* ensure fallback to default works.
*
* @return void
*/
public function testGenerateWithTemplateFallbacks()
{
$this->_loadTestPlugin('TestBakeTheme');
$this->Task->params['theme'] = 'TestBakeTheme';
$this->Task->set(['name' => 'Articles', 'table' => 'articles', 'import' => false, 'records' => false, 'schema' => '', 'namespace' => '']);
$result = $this->Task->generate('tests/fixture');
$this->assertSameAsFile(__FUNCTION__ . '.ctp', $result);
}
示例3: testGenerateWithSiteAccessNoReverseMatch
/**
* @dataProvider generateProvider
*/
public function testGenerateWithSiteAccessNoReverseMatch($urlResource, array $parameters, $referenceType)
{
$matcher = $this->getMock('eZ\\Publish\\Core\\MVC\\Symfony\\SiteAccess\\URILexer');
$this->generator->setSiteAccess(new SiteAccess('test', 'test', $matcher));
$baseUrl = '/base/url';
$requestContext = new RequestContext($baseUrl);
$this->generator->setRequestContext($requestContext);
$uri = '/some/thing';
$this->generator->expects($this->once())->method('doGenerate')->with($urlResource, $parameters)->will($this->returnValue($uri));
$fullUri = $baseUrl . $uri;
$matcher->expects($this->once())->method('analyseLink')->with($uri)->will($this->returnValue($uri));
if ($referenceType === UrlGeneratorInterface::ABSOLUTE_URL) {
$fullUri = $requestContext->getScheme() . '://' . $requestContext->getHost() . $baseUrl . $uri;
}
$siteAccessName = 'fake';
$this->siteAccessRouter->expects($this->once())->method('matchByName')->with($siteAccessName)->will($this->returnValue(null));
$this->logger->expects($this->once())->method('notice');
$this->assertSame($fullUri, $this->generator->generate($urlResource, $parameters + array('siteaccess' => $siteAccessName), $referenceType));
}
示例4: setUpUrlIntegrationServices
/**
* Sets up the unrouted url assembler and the link generator.
*/
protected function setUpUrlIntegrationServices()
{
$this->pathProcessor = $this->getMock('Drupal\\Core\\PathProcessor\\OutboundPathProcessorInterface');
$this->unroutedUrlAssembler = new UnroutedUrlAssembler($this->requestStack, $this->pathProcessor);
\Drupal::getContainer()->set('unrouted_url_assembler', $this->unroutedUrlAssembler);
$this->linkGenerator = new LinkGenerator($this->urlGenerator, $this->getMock('Drupal\\Core\\Extension\\ModuleHandlerInterface'), $this->renderer);
$this->renderer->method('render')->willReturnCallback(function (&$elements, $is_root_call = FALSE) {
// Mock the ability to theme links
$link = $this->linkGenerator->generate($elements['#title'], $elements['#url']);
if (isset($elements['#prefix'])) {
$link = $elements['#prefix'] . $link;
}
if (isset($elements['#suffix'])) {
$link = $link . $elements['#suffix'];
}
return Markup::create($link);
});
}
示例5: testRedirectToNullWithoutFallback
public function testRedirectToNullWithoutFallback()
{
$redirectUrl = $this->redirect->to(null);
$this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl);
}