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


PHP Pool::expects方法代码示例

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


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

示例1: testGenerateLinkDisabledEditAndShow

 public function testGenerateLinkDisabledEditAndShow()
 {
     $component = new Component();
     $component->setModel('Acme\\DemoBundle\\Model\\Demo');
     $component->setIdentifier('2');
     $action = new Action();
     $this->admin->expects($this->at(0))->method('hasRoute')->with($this->equalTo('edit'))->will($this->returnValue(false));
     $this->admin->expects($this->at(1))->method('hasRoute')->with($this->equalTo('show'))->will($this->returnValue(false));
     $this->admin->expects($this->once())->method('toString')->with($this->anything())->will($this->returnValue('Text'));
     $this->assertEquals('Text', $this->twigExtension->generateLink($component, $action));
 }
开发者ID:OskarStark,项目名称:SonataTimelineBundle,代码行数:11,代码来源:SonataTimelineExtensionTest.php

示例2: testMoveWithAdmin

 function testMoveWithAdmin()
 {
     $movedPath = '/cms/to-move';
     $targetPath = '/cms/target/moved';
     $urlSafeId = 'urlSafeId';
     $admin = $this->getMockBuilder('Sonata\\DoctrinePHPCRAdminBundle\\Admin\\Admin')->disableOriginalConstructor()->getMock();
     $admin->expects($this->once())->method('getNormalizedIdentifier')->will($this->returnValue($targetPath));
     $admin->expects($this->once())->method('getUrlsafeIdentifier')->will($this->returnValue($urlSafeId));
     $this->pool->expects($this->once())->method('getAdminByClass')->will($this->returnValue($admin));
     $tree = new PhpcrOdmTree($this->dm, $this->defaultModelManager, $this->pool, $this->translator, $this->assetHelper, array(), array('depth' => 1, 'precise_children' => true));
     $this->assertEquals(array('id' => $targetPath, 'url_safe_id' => $urlSafeId), $tree->move($movedPath, $targetPath));
 }
开发者ID:Aaike,项目名称:SonataDoctrinePhpcrAdminBundle,代码行数:12,代码来源:PhpcrOdmTreeTest.php

示例3: testGetMenuProviderOnTopOptions

 /**
  * @param array $adminGroupsOnTopOption
  *
  * @dataProvider getAdminGroupsWithOnTopOption
  */
 public function testGetMenuProviderOnTopOptions(array $adminGroupsOnTopOption)
 {
     $this->pool->expects($this->once())->method('getInstance')->with($this->equalTo('sonata_admin_foo_service'))->will($this->returnValue($this->getAdminMock(true, false)));
     $menu = $this->provider->get('providerFoo', array('name' => 'foo', 'group' => $adminGroupsOnTopOption));
     $this->assertInstanceOf('Knp\\Menu\\ItemInterface', $menu);
     $this->assertCount(0, $menu->getChildren());
 }
开发者ID:robhunt3r,项目名称:SonataAdminBundle,代码行数:12,代码来源:GroupMenuProviderTest.php


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