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


PHP DocumentManager::expects方法代码示例

本文整理汇总了PHP中Doctrine\ODM\PHPCR\DocumentManager::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP DocumentManager::expects方法的具体用法?PHP DocumentManager::expects怎么用?PHP DocumentManager::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\ODM\PHPCR\DocumentManager的用法示例。


在下文中一共展示了DocumentManager::expects方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 public function setUp()
 {
     $this->dm = $this->getMockBuilder('Doctrine\\ODM\\PHPCR\\DocumentManager')->disableOriginalConstructor()->getMock();
     $this->dm->expects($this->once())->method('find')->will($this->returnValue(new \stdClass()));
     $this->defaultModelManager = $this->getMockBuilder('Sonata\\DoctrinePHPCRAdminBundle\\Model\\ModelManager')->disableOriginalConstructor()->getMock();
     $this->translator = $this->getMockBuilder('Symfony\\Component\\Translation\\TranslatorInterface')->disableOriginalConstructor()->getMock();
     $this->assetHelper = $this->getMockBuilder('Symfony\\Component\\Templating\\Helper\\CoreAssetsHelper')->disableOriginalConstructor()->getMock();
     $this->pool = $this->getMockBuilder('Sonata\\AdminBundle\\Admin\\Pool')->disableOriginalConstructor()->getMock();
 }
开发者ID:Aaike,项目名称:SonataDoctrinePhpcrAdminBundle,代码行数:9,代码来源:PhpcrOdmTreeTest.php

示例2: createGuesser

 /**
  * Create the guesser for this test.
  *
  * @return GuesserInterface
  */
 protected function createGuesser()
 {
     $this->registry = $this->getMockBuilder('\\Doctrine\\Bundle\\PHPCRBundle\\ManagerRegistry')->disableOriginalConstructor()->getMock();
     $this->manager = $this->getMockBuilder('\\Doctrine\\ODM\\PHPCR\\DocumentManager')->disableOriginalConstructor()->getMock();
     $this->metadata = $this->getMockBuilder('\\Doctrine\\ODM\\PHPCR\\Mapping\\ClassMetadata')->disableOriginalConstructor()->getMock();
     $this->registry->expects($this->any())->method('getManagerForClass')->with($this->equalTo('Symfony\\Cmf\\Bundle\\SeoBundle\\Tests\\Unit\\Sitemap\\LastModifiedGuesserTest'))->will($this->returnValue($this->manager));
     $this->manager->expects($this->any())->method('getClassMetadata')->with($this->equalTo('Symfony\\Cmf\\Bundle\\SeoBundle\\Tests\\Unit\\Sitemap\\LastModifiedGuesserTest'))->will($this->returnValue($this->metadata));
     $this->metadata->expects($this->any())->method('getMixins')->will($this->returnValue(array('mix:lastModified')));
     $this->metadata->expects($this->any())->method('getFieldNames')->will($this->returnValue(array('lastModified')));
     $this->metadata->expects($this->any())->method('getFieldMapping')->with($this->equalTo('lastModified'))->will($this->returnValue(array('property' => 'jcr:lastModified')));
     $this->metadata->expects($this->any())->method('getFieldValue')->with($this->equalTo($this), $this->equalTo('lastModified'))->will($this->returnValue(new \DateTime('2016-07-06', new \DateTimeZone('Europe/Berlin'))));
     return new LastModifiedGuesser($this->registry);
 }
开发者ID:symfony-cmf,项目名称:seo-bundle,代码行数:18,代码来源:LastModifiedGuesserTest.php

示例3: setUp

 protected function setUp()
 {
     if (!interface_exists('Doctrine\\Common\\Persistence\\ManagerRegistry')) {
         $this->markTestSkipped('Doctrine Common is not present');
     }
     if (!class_exists('Doctrine\\ODM\\PHPCR\\DocumentManager')) {
         $this->markTestSkipped('Doctrine PHPCR is not present');
     }
     $this->registry = $this->getMockBuilder('Doctrine\\Common\\Persistence\\ManagerRegistry')->disableOriginalConstructor()->getMock();
     $this->manager = $this->getMockBuilder('Doctrine\\ODM\\PHPCR\\DocumentManager')->disableOriginalConstructor()->getMock();
     $this->registry->expects($this->any())->method('getManager')->will($this->returnValue($this->manager));
     $this->repository = $this->getMock('Doctrine\\Common\\Persistence\\ObjectRepository', array('customQueryBuilderCreator', 'createQueryBuilder', 'find', 'findAll', 'findBy', 'findOneBy', 'getClassName'));
     $this->manager->expects($this->any())->method('getRepository')->with($this->objectClass)->will($this->returnValue($this->repository));
 }
开发者ID:anteros,项目名称:FOSElasticaBundle,代码行数:14,代码来源:ElasticaToModelTransformerTest.php

示例4: testAvailableTranslations

 /**
  * URL without locale, set available translations.
  */
 public function testAvailableTranslations()
 {
     $this->routeMock->expects($this->once())->method('getId')->will($this->returnValue('/cms/simple/something'));
     $this->dmMock->expects($this->once())->method('isDocumentTranslatable')->with($this->routeMock)->will($this->returnValue(true));
     $this->dmMock->expects($this->once())->method('getLocalesFor')->with($this->routeMock, true)->will($this->returnValue(array('en', 'de', 'fr')));
     $this->routeMock->expects($this->once())->method('setRequirement')->with('_locale', 'en|de|fr');
     $this->listener->setUpdateAvailableTranslations(true);
     $args = new LifecycleEventArgs($this->routeMock, $this->dmMock);
     $this->listener->postLoad($args);
 }
开发者ID:killerwolf,项目名称:RoutingBundle,代码行数:13,代码来源:LocaleListenerTest.php

示例5: testRootEdgeCase

 public function testRootEdgeCase()
 {
     $this->buildMocks('/');
     $this->managerRegistry->expects($this->any())->method('getManagerForClass')->with(get_class($this->object))->will($this->returnValue($this->documentManager));
     $this->documentManager->expects($this->any())->method('getNodeForDocument')->with($this->object)->willReturn($this->node);
     $this->node->expects($this->any())->method('getDepth')->will($this->returnValue(4));
     $urlInformation = new UrlInformation();
     $this->guesser->guessValues($urlInformation, $this->object, 'default');
     $this->assertEquals(3, $urlInformation->getDepth());
 }
开发者ID:symfony-cmf,项目名称:seo-bundle,代码行数:10,代码来源:DepthGuesserTest.php

示例6: testExpandClassName

 /**
  * @dataProvider provideExpandClassName
  */
 public function testExpandClassName($className, $fqClassName, $isAlias)
 {
     if ($isAlias) {
         $this->dm->expects($this->once())->method('getClassMetadata')->with($className)->will($this->returnValue($this->metadata));
         $this->metadata->expects($this->once())->method('getName')->will($this->returnValue($fqClassName));
     }
     $refl = new \ReflectionClass($this->mapper);
     $method = $refl->getMethod('expandClassName');
     $method->setAccessible(true);
     $res = $method->invoke($this->mapper, $this->dm, $className);
     $this->assertEquals($fqClassName, $res);
 }
开发者ID:steffenbrem,项目名称:phpcr-odm,代码行数:15,代码来源:DocumentClassMapperTest.php

示例7: testChangingDocumentManager

 /**
  * Use getRouteByName() with two different document managers.
  * The two document managers will return different route objects when searching for the same path.
  */
 public function testChangingDocumentManager()
 {
     $this->routeMock->expects($this->any())->method('getPath')->will($this->returnValue('/cms/routes/test-route'));
     $this->route2Mock->expects($this->any())->method('getPath')->will($this->returnValue('/cms/routes/new-route'));
     $this->dmMock->expects($this->any())->method('find')->with(null, '/cms/routes/test-route')->will($this->returnValue($this->routeMock));
     $this->dm2Mock->expects($this->any())->method('find')->with(null, '/cms/routes/test-route')->will($this->returnValue($this->route2Mock));
     $objectManagers = array('default' => $this->dmMock, 'new_manager' => $this->dm2Mock);
     $this->managerRegistryMock = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry');
     $this->managerRegistryMock->expects($this->any())->method('getManager')->will($this->returnCallback(function ($name) use($objectManagers) {
         return $objectManagers[$name];
     }));
     $this->candidatesMock->expects($this->any())->method('isCandidate')->will($this->returnValue(true));
     $routeProvider = new RouteProvider($this->managerRegistryMock, $this->candidatesMock);
     $routeProvider->setManagerName('default');
     $foundRoute = $routeProvider->getRouteByName('/cms/routes/test-route');
     $this->assertInstanceOf('Symfony\\Component\\Routing\\Route', $foundRoute);
     $this->assertEquals('/cms/routes/test-route', $foundRoute->getPath());
     $routeProvider->setManagerName('new_manager');
     $newFoundRoute = $routeProvider->getRouteByName('/cms/routes/test-route');
     $this->assertInstanceOf('Symfony\\Component\\Routing\\Route', $newFoundRoute);
     $this->assertEquals('/cms/routes/new-route', $newFoundRoute->getPath());
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:26,代码来源:RouteProviderTest.php


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