public function testStoreProperties() { $displayname = 'Fu'; $description = 'Same name, different spelling'; $foo = new \BeeHub_Group('/system/groups/foo'); $foo->method_PROPPATCH(\DAV::PROP_DISPLAYNAME, $displayname); $foo->method_PROPPATCH(\BeeHub::PROP_DESCRIPTION, $description); $foo->storeProperties(); // Now, if I create a new instance of BeeHub_Group for the same group, it should have the properties set $fooReloaded = new \BeeHub_Group('/system/groups/foo'); $this->assertSame($displayname, $fooReloaded->user_prop(\DAV::PROP_DISPLAYNAME)); $this->assertSame($description, $fooReloaded->user_prop(\BeeHub::PROP_DESCRIPTION)); }
public function testMethod_POST() { if (!setUpStorageBackend()) { $this->markTestSkipped('No storage backend specified; all tests depending on the storage backend are skipped'); return; } $this->setCurrentUser('/system/users/john'); $_POST['displayname'] = 'Some test group of John'; $_POST['description'] = "This is the description of John's test group"; $_POST['group_name'] = 'johngroup'; $headers = array(); $this->expectOutputRegex('/https 303 See Other/'); $this->obj->method_POST($headers); $group = new \BeeHub_Group('/system/groups/johngroup'); $this->assertSame($_POST['displayname'], $group->user_prop(\DAV::PROP_DISPLAYNAME)); $this->assertSame($_POST['description'], $group->user_prop(\BeeHub::PROP_DESCRIPTION)); $groupFolder = \DAV::$REGISTRY->resource('/' . $_POST['group_name']); $beehubConfig = \BeeHub::config(); $expectedAcl = array(new \DAVACL_Element_ace($group->path, false, array(\DAVACL::PRIV_READ, \DAVACL::PRIV_WRITE), false, false)); $this->assertNull($groupFolder->user_prop(\DAV::PROP_OWNER)); $this->assertEquals($expectedAcl, $groupFolder->user_prop_acl_internal()); $this->assertSame('/system/sponsors/sponsor_a', $groupFolder->user_prop(\BeeHub::PROP_SPONSOR)); }