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


PHP PHPUnit_Framework_MockObject_MockObject::generate方法代码示例

本文整理汇总了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);
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:14,代码来源:BakeTemplateTaskTest.php

示例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));
 }
开发者ID:blankse,项目名称:ezpublish-kernel-1,代码行数:22,代码来源:GeneratorTest.php

示例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);
     });
 }
开发者ID:dmyerson,项目名称:d8ecs,代码行数:21,代码来源:FieldPluginBaseTest.php

示例5: testRedirectToNullWithoutFallback

 public function testRedirectToNullWithoutFallback()
 {
     $redirectUrl = $this->redirect->to(null);
     $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl);
 }
开发者ID:jjanvier,项目名称:wallabag,代码行数:5,代码来源:RedirectTest.php


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