PHP Class Elgg\TestCase

Inheritance: extends PHPUnit_Framework_TestCas\PHPUnit_Framework_TestCase
Exibir arquivo Open project: elgg/elgg Class Usage Examples

Public Properties

Property Type Description
$_instance TestCase
$_mocks Elgg\Mocks\Di\MockServiceProvider

Public Methods

Method Description
__construct ( string $name = NULL, array $data = [], string $dataName = '' ) Constructs a test case with the given name.
bootstrap ( ) : void Bootstraps test suite
config ( Config $config = null ) : Config Get/set Config for testing purposes
getInstance ( ) : TestCase Returns current test instance
getTestingConfigArray ( ) : array Returns default testing configuration array
mocks ( ) : Elgg\TestCaseMocks Retuns mocking utility library
prepareHttpRequest ( string $uri = '', string $method = 'GET', array $parameters = [], integer $ajax, boolean $add_csrf_tokens = false ) : Request Create an HTTP request
setupMockServices ( boolean $reset = true ) : void Substitute database dependent services with their doubles

Method Details

__construct() public method

Bootstraps testing environment
public __construct ( string $name = NULL, array $data = [], string $dataName = '' )
$name string
$data array
$dataName string

bootstrap() public static method

Bootstraps test suite
public static bootstrap ( ) : void
return void

config() public static method

Get/set Config for testing purposes
public static config ( Config $config = null ) : Config
$config Config Config
return Config

getInstance() public static method

Returns current test instance
public static getInstance ( ) : TestCase
return TestCase

getTestingConfigArray() public static method

Returns default testing configuration array
public static getTestingConfigArray ( ) : array
return array

mocks() public static method

Retuns mocking utility library
public static mocks ( ) : Elgg\TestCaseMocks
return Elgg\TestCaseMocks

prepareHttpRequest() public static method

Create an HTTP request
public static prepareHttpRequest ( string $uri = '', string $method = 'GET', array $parameters = [], integer $ajax, boolean $add_csrf_tokens = false ) : Request
$uri string URI of the request
$method string HTTP method
$parameters array Query/Post parameters
$ajax integer AJAX api version (0 for non-ajax)
$add_csrf_tokens boolean Add CSRF tokens
return Elgg\Http\Request

setupMockServices() public static method

Substitute database dependent services with their doubles
public static setupMockServices ( boolean $reset = true ) : void
$reset boolean Reset service provider
return void

Property Details

$_instance static_oe public_oe property

static public TestCase,elgg $_instance
return TestCase

$_mocks static_oe public_oe property

static public MockServiceProvider,Elgg\Mocks\Di $_mocks
return Elgg\Mocks\Di\MockServiceProvider