public function testMethod_POST() { $this->setCurrentUser('/system/users/john'); $_POST['displayname'] = 'Some test sponsor of John'; $_POST['description'] = "This is the description of John's test sponsor"; $_POST['sponsor_name'] = 'johnsponsor'; $headers = array(); $this->expectOutputRegex('/https 303 See Other/'); $this->obj->method_POST($headers); $sponsor = new \BeeHub_Sponsor('/system/sponsors/johnsponsor'); $this->assertSame($_POST['displayname'], $sponsor->user_prop(\DAV::PROP_DISPLAYNAME)); $this->assertSame($_POST['description'], $sponsor->user_prop(\BeeHub::PROP_DESCRIPTION)); }
public function testStoreProperties() { $displayname = 'A sponsor'; $description = 'Same name, different spelling'; $sponsor = new \BeeHub_Sponsor('/system/sponsors/sponsor_a'); $sponsor->method_PROPPATCH(\DAV::PROP_DISPLAYNAME, $displayname); $sponsor->method_PROPPATCH(\BeeHub::PROP_DESCRIPTION, $description); $sponsor->storeProperties(); // Now, if I create a new instance of BeeHub_Sponsor for the same sponsor, it should have the properties set $sponsorReloaded = new \BeeHub_Sponsor('/system/sponsors/sponsor_a'); $this->assertSame($displayname, $sponsorReloaded->user_prop(\DAV::PROP_DISPLAYNAME)); $this->assertSame($description, $sponsorReloaded->user_prop(\BeeHub::PROP_DESCRIPTION)); }