PHP 클래스 AppTestCase

상속: extends BaseDbTestCase
파일 보기 프로젝트 열기: cakedc/templates 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$dependedFixtures array Fixtures
$fixtures array Fixtures
$plugin string Autoload entrypoint for fixtures dependecy solver

보호된 프로퍼티들

프로퍼티 타입 설명
$_testsToRun array Test to run for the test case (e.g array('testFind', 'testView')) If this attribute is not empty only the tests from the list will be executed

공개 메소드들

메소드 설명
__construct ( $name = null, array $data = [], $dataName = '' ) : void Constructor
assertFalse ( $condition, $message = '' )
assertInvalid ( Model $Model, array $data ) : void Asserts that data are invalid given Model validation rules Calls the Model::validate() method and asserts the result
assertIsA ( $actual, $expected, $message = '' )
assertNotA ( $actual, $expected, $message = '' )
assertTrue ( $condition, $message = '' )
assertValid ( Model $Model, array $data ) : void Asserts that data are valid given Model validation rules Calls the Model::validate() method and asserts the result
assertValidationErrors ( Model $Model, array $data, array $expectedErrors ) : void Asserts that data are validation errors match an expected value when validation given data for the Model Calls the Model::validate() method and asserts validationErrors
getTests ( ) : array Overrides parent method to allow selecting tests to run in the current test case It is useful when working on one particular test
loadConfig ( string $fileName, string $type = 'app' ) : mixed Loads a file from app/tests/config/configure_file.php or app/plugins/PLUGIN/tests/config/configure_file.php
mockCakeEmail ( ) : PHPUnit_Framework_MockObject_MockObject Provides conventional method to mock CakeEmail object
pass ( $message = '' )
solveDependancies ( string $plugin ) : array Solves Plugin Fixture dependancies. Called in AppTestCase::__construct to solve fixture dependancies. Uses a Plugins tests/config/dependent and tests/config/fixtures to load plugin fixtures. To use this feature set $plugin = 'pluginName' in your test case.

보호된 메소드들

메소드 설명
_validData ( Model $Model, array $data, array &$validationErrors = [] ) : boolean Convenience method allowing to validate data and return the result

메소드 상세

__construct() 공개 메소드

If a class is extending AppTestCase it will merge these with the extending classes so that you don't have to put the plugin fixtures into the AppTestCase
public __construct ( $name = null, array $data = [], $dataName = '' ) : void
$data array
리턴 void

_validData() 보호된 메소드

Convenience method allowing to validate data and return the result
protected _validData ( Model $Model, array $data, array &$validationErrors = [] ) : boolean
$Model Model Model being tested
$data array Profile data
$validationErrors array Validation errors: this variable will be updated with validationErrors (sorted by key) in case of validation fail
리턴 boolean Return value of Model::validate()

assertFalse() 공개 정적인 메소드

public static assertFalse ( $condition, $message = '' )

assertInvalid() 공개 메소드

Asserts that data are invalid given Model validation rules Calls the Model::validate() method and asserts the result
public assertInvalid ( Model $Model, array $data ) : void
$Model Model Model being tested
$data array Data to validate
리턴 void

assertIsA() 공개 정적인 메소드

public static assertIsA ( $actual, $expected, $message = '' )

assertNotA() 공개 정적인 메소드

public static assertNotA ( $actual, $expected, $message = '' )

assertTrue() 공개 정적인 메소드

public static assertTrue ( $condition, $message = '' )

assertValid() 공개 메소드

Asserts that data are valid given Model validation rules Calls the Model::validate() method and asserts the result
public assertValid ( Model $Model, array $data ) : void
$Model Model Model being tested
$data array Data to validate
리턴 void

assertValidationErrors() 공개 메소드

Asserts that data are validation errors match an expected value when validation given data for the Model Calls the Model::validate() method and asserts validationErrors
public assertValidationErrors ( Model $Model, array $data, array $expectedErrors ) : void
$Model Model Model being tested
$data array Data to validate
$expectedErrors array Expected errors keys
리턴 void

getTests() 공개 메소드

Overrides parent method to allow selecting tests to run in the current test case It is useful when working on one particular test
public getTests ( ) : array
리턴 array List of tests to run

loadConfig() 공개 메소드

Config file variables should be formated like: $config['name'] = 'value'; These will be used to create dynamic Configure vars.
public loadConfig ( string $fileName, string $type = 'app' ) : mixed
$fileName string name of file to load, extension must be .php and only the name should be used, not the extenstion.
$type string Type of config file being loaded. If equal to 'app' core config files will be use. if $type == 'pluginName' that plugins tests/config files will be loaded.
리턴 mixed false if file not found, void if load successful

mockCakeEmail() 공개 메소드

Provides conventional method to mock CakeEmail object
public mockCakeEmail ( ) : PHPUnit_Framework_MockObject_MockObject
리턴 PHPUnit_Framework_MockObject_MockObject

pass() 공개 메소드

public pass ( $message = '' )

solveDependancies() 공개 메소드

Solves Plugin Fixture dependancies. Called in AppTestCase::__construct to solve fixture dependancies. Uses a Plugins tests/config/dependent and tests/config/fixtures to load plugin fixtures. To use this feature set $plugin = 'pluginName' in your test case.
public solveDependancies ( string $plugin ) : array
$plugin string Name of the plugin to load
리턴 array Array of plugins that this plugin's test cases depend on.

프로퍼티 상세

$_testsToRun 보호되어 있는 프로퍼티

Test to run for the test case (e.g array('testFind', 'testView')) If this attribute is not empty only the tests from the list will be executed
protected array $_testsToRun
리턴 array

$dependedFixtures 공개적으로 프로퍼티

Fixtures
public array $dependedFixtures
리턴 array

$fixtures 공개적으로 프로퍼티

Fixtures
public array $fixtures
리턴 array

$plugin 공개적으로 프로퍼티

Autoload entrypoint for fixtures dependecy solver
public string $plugin
리턴 string