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


PHP Server::broadCastEvent方法代码示例

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


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

示例1: testCurrentUserPrincipal

 function testCurrentUserPrincipal()
 {
     $fakeServer = new DAV\Server();
     $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock(), 'realm');
     $fakeServer->addPlugin($plugin);
     $plugin = new Plugin();
     $fakeServer->addPlugin($plugin);
     $requestedProperties = array('{DAV:}current-user-principal');
     $returnedProperties = array(200 => array(), 404 => array());
     $this->assertNull($plugin->beforeGetProperties('', new DAV\SimpleCollection('root'), $requestedProperties, $returnedProperties));
     $this->assertEquals(1, count($returnedProperties[200]));
     $this->assertArrayHasKey('{DAV:}current-user-principal', $returnedProperties[200]);
     $this->assertInstanceOf('Sabre\\DAVACL\\Property\\Principal', $returnedProperties[200]['{DAV:}current-user-principal']);
     $this->assertEquals(Property\Principal::UNAUTHENTICATED, $returnedProperties[200]['{DAV:}current-user-principal']->getType());
     // This will force the login
     $fakeServer->broadCastEvent('beforeMethod', array('GET', ''));
     $requestedProperties = array('{DAV:}current-user-principal');
     $returnedProperties = array(200 => array(), 404 => array());
     $this->assertNull($plugin->beforeGetProperties('', new DAV\SimpleCollection('root'), $requestedProperties, $returnedProperties));
     $this->assertEquals(1, count($returnedProperties[200]));
     $this->assertArrayHasKey('{DAV:}current-user-principal', $returnedProperties[200]);
     $this->assertInstanceOf('Sabre\\DAVACL\\Property\\Principal', $returnedProperties[200]['{DAV:}current-user-principal']);
     $this->assertEquals(Property\Principal::HREF, $returnedProperties[200]['{DAV:}current-user-principal']->getType());
     $this->assertEquals('principals/admin/', $returnedProperties[200]['{DAV:}current-user-principal']->getHref());
 }
开发者ID:samj1912,项目名称:repo,代码行数:25,代码来源:PluginPropertiesTest.php

示例2: testGetCurrentUserPrincipal

 /**
  * @depends testInit
  */
 function testGetCurrentUserPrincipal()
 {
     $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla'));
     $plugin = new Plugin(new Backend\Mock(), 'realm');
     $fakeServer->addPlugin($plugin);
     $fakeServer->broadCastEvent('beforeMethod', array('GET', '/'));
     $this->assertEquals('admin', $plugin->getCurrentUser());
 }
开发者ID:TamirAl,项目名称:hubzilla,代码行数:11,代码来源:PluginTest.php


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