PHP Class Scalr\Tests\WebTestCase

Since: 21.02.2013
Author: Vitaliy Demidov ([email protected])
Inheritance: extends TestCase
Show file Open project: scalr/scalr Class Usage Examples

Protected Properties

Property Type Description
$_testEnvId integer ID of the user's environment
$_testUserId integer ID of the user which is used in the functional test

Protected Methods

Method Description
assertResponseDataHasKeys ( array $keys, array $responseData, boolean $checkAll = false, string $dataColumnName = 'data' ) Asserts that response data array has necessary data keys.
getEnvironment ( ) : Scalr_Environment Gets a test environment instance
getRequest ( $requestType = Scalr_UI_Request::REQUEST_TYPE_UI, $requestClass = null, striing $uri, array $parameters = [], string $method = 'GET', array $server = [], array $files = [] ) : Scalr_UI_Request Prepares request
getUser ( ) : Scalr_Account_user Gets an test User instance
internalRequest ( string $uri, array $parameters = [] ) : mixed Get internal request to the controller's action ignoring checking aliases
isAdminUserTestClass ( ) : boolean Returns true if current test is for Scalr Admin privilege
markTestSkippedIfFunctionalTestsDisabled ( ) Marks test skipped if functional tests are disabled
markTestSkippedIfPlatformDisabled ( string $platform ) Skip test if platform does not enabled
request ( string $uri, array $parameters = [], string $method = 'GET', array $server = [], array $files = [] ) : array | string Makes a request to site
setUp ( )
tearDown ( )

Method Details

assertResponseDataHasKeys() protected method

Asserts that response data array has necessary data keys.
protected assertResponseDataHasKeys ( array $keys, array $responseData, boolean $checkAll = false, string $dataColumnName = 'data' )
$keys array Array of the keys or Index array that looks like array($key => $constraint)
$responseData array Response array
$checkAll boolean optional Whether it should check all data array or only the first.
$dataColumnName string optional The name of the data column

getEnvironment() protected method

Gets a test environment instance
protected getEnvironment ( ) : Scalr_Environment
return Scalr_Environment Returns environment instance

getRequest() protected method

Prepares request
protected getRequest ( $requestType = Scalr_UI_Request::REQUEST_TYPE_UI, $requestClass = null, striing $uri, array $parameters = [], string $method = 'GET', array $server = [], array $files = [] ) : Scalr_UI_Request
$uri striing A request uri
$parameters array optional Request parameters
$method string optional HTTP Request method
$server array optional Additional server options
$files array optional Uploaded files array
return Scalr_UI_Request Returns array which represents returned json object or raw body content in the case if the response is not a json.

getUser() protected method

Gets an test User instance
protected getUser ( ) : Scalr_Account_user
return Scalr_Account_user Returns user instance

internalRequest() protected method

Get internal request to the controller's action ignoring checking aliases
protected internalRequest ( string $uri, array $parameters = [] ) : mixed
$uri string
$parameters array
return mixed Returns raw response as it is returned by action

isAdminUserTestClass() protected method

Returns true if current test is for Scalr Admin privilege
protected isAdminUserTestClass ( ) : boolean
return boolean

markTestSkippedIfFunctionalTestsDisabled() protected method

Marks test skipped if functional tests are disabled

markTestSkippedIfPlatformDisabled() protected method

Skip test if platform does not enabled
protected markTestSkippedIfPlatformDisabled ( string $platform )
$platform string

request() protected method

Makes a request to site
protected request ( string $uri, array $parameters = [], string $method = 'GET', array $server = [], array $files = [] ) : array | string
$uri string A request uri
$parameters array optional Request parameters
$method string optional HTTP Request method
$server array optional Additional server options
$files array optional Uploaded files array
return array | string Returns array which represents returned json object or raw body content in the case if the responce is not a json.

setUp() protected method

See also: PHPUnit_Framework_TestCase::setUp()
protected setUp ( )

tearDown() protected method

See also: PHPUnit_Framework_TestCase::tearDown()
protected tearDown ( )

Property Details

$_testEnvId protected property

ID of the user's environment
protected int $_testEnvId
return integer

$_testUserId protected property

ID of the user which is used in the functional test
protected int $_testUserId
return integer