public function testVerify_email_address() { $user = new \BeeHub_User('/system/users/jane'); $this->assertSame('*****@*****.**', $user->user_prop(\BeeHub::PROP_EMAIL)); $this->assertFalse($user->verify_email_address('The wrong e-mail verification code')); $this->assertTrue($user->verify_email_address('somesecretcode')); $this->assertSame('*****@*****.**', $user->user_prop(\BeeHub::PROP_EMAIL)); }
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()); }