本文整理汇总了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));
}
示例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));
}
示例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());
}