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