Wt::Test::WTestEnvironment Class Reference

An environment for testing purposes. More...

#include <Wt/Test/WTestEnvironment>

Inherits Wt::WEnvironment.

List of all members.

Public Member Functions

 WTestEnvironment (const std::string &applicationPath="/", const std::string &configurationFile="", EntryPointType type=Application)
 Default constructor.
 ~WTestEnvironment ()
 Destructor.
void setParameterMap (const Http::ParameterMap &parameters)
 Sets parameters to the application.
void setCookies (const CookieMap &cookies)
 Sets HTTP cookies.
void setHeaderValue (const std::string &value)
 Sets a HTTP header value.
void setSupportsCookies (bool enabled)
 Sets whether cookies are supported.
void setAjax (bool enabled)
 Sets whether AJAX is supported.
void setDpiScale (double dpiScale)
 Sets the display's DPI scale.
void setLocale (const std::string &locale)
 Sets the locale.
void setHostName (const std::string &hostName)
 Sets the host name.
void setUrlScheme (const std::string &scheme)
 Sets the URL scheme.
void setUserAgent (const std::string &userAgent)
 Sets the user agent.
void setReferer (const std::string &referer)
 Sets the referer.
void setAccept (const std::string &accept)
 Sets the accept header.
void setServerSignature (const std::string &signature)
 Sets the server signature.
void setServerSoftware (const std::string &software)
 Sets the server software.
void setServerAdmin (const std::string &serverAdmin)
 Sets the server admin.
void setClientAddress (const std::string &clientAddress)
 Sets the client address.
void setInternalPath (const std::string &internalPath)
 Sets the initial internal path.
void setContentType (ContentType contentType)
 Sets the content type.

Detailed Description

An environment for testing purposes.

This environment is useful for use in unit tests: you may configure its properties and pass it to the constructor of an application.

This is useful for (unit) test-cases:

 void testX() {
   Test::WTestEnvironment environment;
   MyApplication app(environment);
   ...
 }
See also:
WEnvironment, WApplication::WApplication(const WEnvironment&)

Constructor & Destructor Documentation

Wt::Test::WTestEnvironment::WTestEnvironment ( const std::string &  applicationPath = "/",
const std::string &  configurationFile = "",
EntryPointType  type = Application 
)

Default constructor.

Constructs a test environment that resembles FireFox 3.0 with default settings.

The applicationPath is the simulated deployment path. The configuration file points to a wt_config.xml configuration file. The type indicates the application type.

After construction, but before passing it to the constructor of a WApplication, you can change any of the environment properties using the setter methods.

Wt::Test::WTestEnvironment::~WTestEnvironment (  ) 

Destructor.

!


Member Function Documentation

void Wt::Test::WTestEnvironment::setAccept ( const std::string &  accept  ) 

Sets the accept header.

The default value is "text/html,application/xhtml+xml,application/xml;q=0.9,* /*;q=0.8".

See also:
accept()
void Wt::Test::WTestEnvironment::setAjax ( bool  enabled  ) 

Sets whether AJAX is supported.

The default value is true.

See also:
ajax()
void Wt::Test::WTestEnvironment::setClientAddress ( const std::string &  clientAddress  ) 

Sets the client address.

The default value is "127.0.0.1".

See also:
clientAddress()
void Wt::Test::WTestEnvironment::setContentType ( ContentType  contentType  ) 

Sets the content type.

The default value is XHTML1.

See also:
contentType()
void Wt::Test::WTestEnvironment::setCookies ( const CookieMap cookies  ) 

Sets HTTP cookies.

The default value is an empty map.

See also:
cookies()
void Wt::Test::WTestEnvironment::setDpiScale ( double  dpiScale  ) 

Sets the display's DPI scale.

The default value is 1.

See also:
dpiScale()
void Wt::Test::WTestEnvironment::setHeaderValue ( const std::string &  value  ) 

Sets a HTTP header value.

The default value is no headers.

See also:
headerValue()
void Wt::Test::WTestEnvironment::setHostName ( const std::string &  hostName  ) 

Sets the host name.

The default value is "localhost".

See also:
hostName()
void Wt::Test::WTestEnvironment::setInternalPath ( const std::string &  internalPath  ) 

Sets the initial internal path.

The default value is "".

See also:
internalPath()

Reimplemented from Wt::WEnvironment.

void Wt::Test::WTestEnvironment::setLocale ( const std::string &  locale  ) 

Sets the locale.

The default value is "en".

See also:
locale()
void Wt::Test::WTestEnvironment::setParameterMap ( const Http::ParameterMap parameters  ) 

Sets parameters to the application.

The default value is an empty map.

See also:
getParameterMap()
void Wt::Test::WTestEnvironment::setReferer ( const std::string &  referer  ) 

Sets the referer.

The default value is "".

See also:
referer()
void Wt::Test::WTestEnvironment::setServerAdmin ( const std::string &  serverAdmin  ) 

Sets the server admin.

The default value is "your@onyourown.here".

See also:
serverAdmin()
void Wt::Test::WTestEnvironment::setServerSignature ( const std::string &  signature  ) 

Sets the server signature.

The default value is "None (WTestEnvironment)".

See also:
serverSignature()
void Wt::Test::WTestEnvironment::setServerSoftware ( const std::string &  software  ) 

Sets the server software.

The default value is "None (WTestEnvironment)".

See also:
serverSoftware()
void Wt::Test::WTestEnvironment::setSupportsCookies ( bool  enabled  ) 

Sets whether cookies are supported.

The default value is true.

See also:
supportsCookies()
void Wt::Test::WTestEnvironment::setUrlScheme ( const std::string &  scheme  ) 

Sets the URL scheme.

The default value is "http".

See also:
urlScheme()
void Wt::Test::WTestEnvironment::setUserAgent ( const std::string &  userAgent  ) 

Sets the user agent.

The default value is no "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.11) Gecko/2009060309 Ubuntu/9.04 (jaunty) Firefox/3.0.11".

See also:
userAgent()

Reimplemented from Wt::WEnvironment.


Generated on Thu May 13 05:16:20 2010 for Wt by doxygen 1.6.3