public function testMethod_POST_newPassword() { $this->setCurrentUser('/system/users/jane'); $_POST['new_password'] = '******'; $_POST['password'] = '******'; $headers = array(); $user = new \BeeHub_User('/system/users/jane'); $this->assertTrue($user->check_password('password_of_jane')); $this->expectOutputRegex('/https 303 See Other/'); $user->method_POST($headers); $this->assertTrue($user->check_password('new password for jane')); }
public function testMethod_POST() { if (!setUpStorageBackend()) { $this->markTestSkipped('No storage backend specified; all tests depending on the storage backend are skipped'); return; } $_POST['user_name'] = 'jdoe'; $_POST['displayname'] = 'J Doe'; $_POST['email'] = "*****@*****.**"; $_POST['password'] = '******'; $headers = array(); $obj = $this->getMock('\\BeeHub_Users', array('include_view'), array('/system/users/')); $obj->expects($this->any())->method('include_view')->with($this->equalTo('new_user_confirmation'), $this->equalTo(array('email_address' => $_POST['email']))); $emailer = $this->getMock('\\BeeHub_Emailer', array('email')); $emailer->expects($this->once())->method('email'); \BeeHub::setEmailer($emailer); $this->expectOutputRegex('/html/'); $this->obj->method_POST($headers); $user = new \BeeHub_User('/system/users/jdoe'); $this->assertSame($_POST['displayname'], $user->user_prop(\DAV::PROP_DISPLAYNAME)); $this->assertTrue($user->check_password($_POST['password'])); $userFolder = \DAV::$REGISTRY->resource('/home/' . $_POST['user_name']); $beehubConfig = \BeeHub::config(); $this->assertSame($user->path, $userFolder->user_prop(\DAV::PROP_OWNER)); \BeeHub::setEmailer(new \BeeHub_Emailer()); }