當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。