예제 #1
0
	public static function createURL($params, $language = null, $anchor = null)
	{
		if (is_string($params))
		{
			$params = array($params);
		}
		if (count($params) == 1 && $params[0] == 'home/index') $params = array();
		
		$urlPrefix = '';
		if (self::$_config->has('urlPrefix'))
		{
			if (!$language)
			{
				$language = self::getLanguage();
			}
			
			$urlPrefix = self::$_config->get('urlPrefix').'/';
			$urlPrefix = str_replace(':language', $language, $urlPrefix);
			if ($urlPrefix == '/') $urlPrefix = '';
		}
		foreach ($params as $k=>&$p)
		{
			if ($k > 0)
			{
				$p = coorgencode($p);
			}
		}
	
		$url = self::$_config->get('path').$urlPrefix.implode('/', $params);
		self::normalizeRequest($url);
		if ($anchor)
		{
			$url .= '#'.$anchor;
		}
		return $url;
	}
	public function testRenewPassword()
	{
		$dvorak = User::getUserByName('dvorak');
		$key = $dvorak->resetPassword();
		$dvorak->save();
		
		$this->request('user/password/renew/dvorak/'.coorgencode($key));
		
		$this->assertMailSent('*****@*****.**', 'The Site: Your new password',
		                      'mails/passwordrenew',
		                      array('username' => 'dvorak',
		                            'newpassword' => '**?**',
		                            'loginURL' => 'http://www.test.info/user/login',
		                            'site' => 'The Site'));
		$this->assertFlashNotice('A mail has been sent to you, containing your new password');
		$this->assertRedirected('/');
		
	}