包 | system.test |
---|---|
继承 | abstract class CWebTestCase » PHPUnit_Extensions_SeleniumTestCase » PHPUnit_Framework_TestCase » PHPUnit_Framework_Assert |
实现 | PHPUnit_Framework_Test, Countable, PHPUnit_Framework_SelfDescribing |
源自 | 1.1 |
版本 | $Id: CWebTestCase.php 3426 2011-10-25 00:01:09Z alexander.makarow $ |
源码 |
It extends PHPUnit_Extensions_SeleniumTestCase and provides the database fixture management feature like CDbTestCase.
公共属性
属性 | 类型 | 描述 | 定义在 |
---|---|---|---|
browsers | array | PHPUnit_Extensions_SeleniumTestCase |
受保护属性
属性 | 类型 | 描述 | 定义在 |
---|---|---|---|
backupGlobals | boolean | Enable or disable the backup and restoration of the $GLOBALS array. | PHPUnit_Framework_TestCase |
backupGlobalsBlacklist | array | PHPUnit_Framework_TestCase | |
backupStaticAttributes | boolean | Enable or disable the backup and restoration of static attributes. | PHPUnit_Framework_TestCase |
backupStaticAttributesBlacklist | array | PHPUnit_Framework_TestCase | |
browserName | string | PHPUnit_Extensions_SeleniumTestCase | |
captureScreenshotOnFailure | boolean | PHPUnit_Extensions_SeleniumTestCase | |
collectCodeCoverageInformation | boolean | PHPUnit_Extensions_SeleniumTestCase | |
coverageScriptUrl | string | PHPUnit_Extensions_SeleniumTestCase | |
drivers | PHPUnit_Extensions_SeleniumTestCase_Driver[] | PHPUnit_Extensions_SeleniumTestCase | |
fixtures | array | a list of fixtures that should be loaded before each test method executes. | CWebTestCase |
inDefaultAssertions | boolean | PHPUnit_Extensions_SeleniumTestCase | |
preserveGlobalState | boolean | Whether or not this test should preserve the global state when | PHPUnit_Framework_TestCase |
runTestInSeparateProcess | boolean | Whether or not this test is to be run in a separate PHP process. | PHPUnit_Framework_TestCase |
screenshotPath | string | PHPUnit_Extensions_SeleniumTestCase | |
screenshotUrl | string | PHPUnit_Extensions_SeleniumTestCase | |
testId | string | PHPUnit_Extensions_SeleniumTestCase | |
verificationErrors | array | PHPUnit_Extensions_SeleniumTestCase |
公共方法
方法 | 描述 | 定义在 |
---|---|---|
__call() | PHP magic method. | CWebTestCase |
__construct() | PHPUnit_Extensions_SeleniumTestCase | |
__get() | PHP magic method. | CWebTestCase |
addToAssertionCount() | Adds a value to the assertion counter. | PHPUnit_Framework_TestCase |
any() | Returns a matcher that matches when the method it is evaLuated for | PHPUnit_Framework_TestCase |
anything() | Returns a PHPUnit_Framework_Constraint_IsAnything matcher object. | PHPUnit_Framework_Assert |
arrayHasKey() | Returns a PHPUnit_Framework_Constraint_ArrayHasKey matcher object. | PHPUnit_Framework_Assert |
assertArrayHasKey() | Asserts that an array has a specified key. | PHPUnit_Framework_Assert |
assertArrayNotHasKey() | Asserts that an array does not have a specified key. | PHPUnit_Framework_Assert |
assertAttributeContains() | Asserts that a haystack that is stored in a static attribute of a class | PHPUnit_Framework_Assert |
assertAttributeContainsOnly() | Asserts that a haystack that is stored in a static attribute of a class | PHPUnit_Framework_Assert |
assertAttributeEmpty() | Asserts that a static attribute of a class or an attribute of an object | PHPUnit_Framework_Assert |
assertAttributeEquals() | Asserts that a variable is equal to an attribute of an object. | PHPUnit_Framework_Assert |
assertAttributeGreaterThan() | Asserts that an attribute is greater than another value. | PHPUnit_Framework_Assert |
assertAttributeGreaterThanOrEqual() | Asserts that an attribute is greater than or equal to another value. | PHPUnit_Framework_Assert |
assertAttributeInstanceOf() | Asserts that an attribute is of a given type. | PHPUnit_Framework_Assert |
assertAttributeInternalType() | Asserts that an attribute is of a given type. | PHPUnit_Framework_Assert |
assertAttributeLessThan() | Asserts that an attribute is smaller than another value. | PHPUnit_Framework_Assert |
assertAttributeLessThanOrEqual() | Asserts that an attribute is smaller than or equal to another value. | PHPUnit_Framework_Assert |
assertAttributeNotContains() | Asserts that a haystack that is stored in a static attribute of a class | PHPUnit_Framework_Assert |
assertAttributeNotContainsOnly() | Asserts that a haystack that is stored in a static attribute of a class | PHPUnit_Framework_Assert |
assertAttributeNotEmpty() | Asserts that a static attribute of a class or an attribute of an object | PHPUnit_Framework_Assert |
assertAttributeNotEquals() | Asserts that a variable is not equal to an attribute of an object. | PHPUnit_Framework_Assert |
assertAttributeNotInstanceOf() | Asserts that an attribute is of a given type. | PHPUnit_Framework_Assert |
assertAttributeNotInternalType() | Asserts that an attribute is of a given type. | PHPUnit_Framework_Assert |
assertAttributeNotSame() | Asserts that a variable and an attribute of an object do not have the | PHPUnit_Framework_Assert |
assertAttributeNotType() | Asserts that an attribute is of a given type. | PHPUnit_Framework_Assert |
assertAttributeSame() | Asserts that a variable and an attribute of an object have the same type | PHPUnit_Framework_Assert |
assertAttributeType() | Asserts that an attribute is of a given type. | PHPUnit_Framework_Assert |
assertClasshasAttribute() | Asserts that a class has a specified attribute. | PHPUnit_Framework_Assert |
assertClassHasStaticAttribute() | Asserts that a class has a specified static attribute. | PHPUnit_Framework_Assert |
assertClassNotHasAttribute() | Asserts that a class does not have a specified attribute. | PHPUnit_Framework_Assert |
assertClassNotHasStaticAttribute() | Asserts that a class does not have a specified static attribute. | PHPUnit_Framework_Assert |
assertContains() | Asserts that a haystack contains a needle. | PHPUnit_Framework_Assert |
assertContainsOnly() | Asserts that a haystack contains only values of a given type. | PHPUnit_Framework_Assert |
assertElementContainsText() | Asserts that an element contains a given string. | PHPUnit_Extensions_SeleniumTestCase |
assertElementNotContainsText() | Asserts that an element does not contain a given string. | PHPUnit_Extensions_SeleniumTestCase |
assertElementValueContains() | Asserts that an element's value contains a given string. | PHPUnit_Extensions_SeleniumTestCase |
assertElementValueEquals() | Asserts that an element's value is equal to a given string. | PHPUnit_Extensions_SeleniumTestCase |
assertElementValueNotContains() | Asserts that an element's value does not contain a given string. | PHPUnit_Extensions_SeleniumTestCase |
assertElementValueNotEquals() | Asserts that an element's value is not equal to a given string. | PHPUnit_Extensions_SeleniumTestCase |
assertEmpty() | Asserts that a variable is empty. | PHPUnit_Framework_Assert |
assertEqualXMLStructure() | Asserts that a hierarchy of DOMNodes matches. | PHPUnit_Framework_Assert |
assertEquals() | Asserts that two variables are equal. | PHPUnit_Framework_Assert |
assertFalse() | Asserts that a condition is false. | PHPUnit_Framework_Assert |
assertFileEquals() | Asserts that the contents of one file is equal to the contents of another | PHPUnit_Framework_Assert |
assertFileExists() | Asserts that a file exists. | PHPUnit_Framework_Assert |
assertFileNotEquals() | Asserts that the contents of one file is not equal to the contents of | PHPUnit_Framework_Assert |
assertFileNotExists() | Asserts that a file does not exist. | PHPUnit_Framework_Assert |
assertGreaterThan() | Asserts that a value is greater than another value. | PHPUnit_Framework_Assert |
assertGreaterThanOrEqual() | Asserts that a value is greater than or equal to another value. | PHPUnit_Framework_Assert |
assertInstanceOf() | Asserts that a variable is of a given type. | PHPUnit_Framework_Assert |
assertInternalType() | Asserts that a variable is of a given type. | PHPUnit_Framework_Assert |
assertIsNotSelected() | Asserts that a specific value is not selected. | PHPUnit_Extensions_SeleniumTestCase |
assertIsSelected() | Asserts that a specific value is selected. | PHPUnit_Extensions_SeleniumTestCase |
assertLessThan() | Asserts that a value is smaller than another value. | PHPUnit_Framework_Assert |
assertLessThanOrEqual() | Asserts that a value is smaller than or equal to another value. | PHPUnit_Framework_Assert |
assertNotContains() | Asserts that a haystack does not contain a needle. | PHPUnit_Framework_Assert |
assertNotContainsOnly() | Asserts that a haystack does not contain only values of a given type. | PHPUnit_Framework_Assert |
assertNotEmpty() | Asserts that a variable is not empty. | PHPUnit_Framework_Assert |
assertNotEquals() | Asserts that two variables are not equal. | PHPUnit_Framework_Assert |
assertNotInstanceOf() | Asserts that a variable is not of a given type. | PHPUnit_Framework_Assert |
assertNotInternalType() | Asserts that a variable is not of a given type. | PHPUnit_Framework_Assert |
assertNotNull() | Asserts that a variable is not NULL. | PHPUnit_Framework_Assert |
assertNotRegExp() | Asserts that a string does not match a given regular expression. | PHPUnit_Framework_Assert |
assertNotSame() | Asserts that two variables do not have the same type and value. | PHPUnit_Framework_Assert |
assertNotSelected() | Asserts that a specific label is not selected. | PHPUnit_Extensions_SeleniumTestCase |
assertNotTag() | This assertion is the exact opposite of assertTag(). | PHPUnit_Framework_Assert |
assertNotType() | Asserts that a variable is not of a given type. | PHPUnit_Framework_Assert |
assertNull() | Asserts that a variable is NULL. | PHPUnit_Framework_Assert |
assertObjectHasAttribute() | Asserts that an object has a specified attribute. | PHPUnit_Framework_Assert |
assertObjectNotHasAttribute() | Asserts that an object does not have a specified attribute. | PHPUnit_Framework_Assert |
assertRegExp() | Asserts that a string matches a given regular expression. | PHPUnit_Framework_Assert |
assertSame() | Asserts that two variables have the same type and value. | PHPUnit_Framework_Assert |
assertSelectCount() | Assert the presence, absence, or count of elements in a document matching | PHPUnit_Framework_Assert |
assertSelectEquals() | assertSelectEquals("#binder .name", "Chuck", true, $xml); // any? | PHPUnit_Framework_Assert |
assertSelectHasOption() | Asserts that a select element has a specific option. | PHPUnit_Extensions_SeleniumTestCase |
assertSelectNotHasOption() | Asserts that a select element does not have a specific option. | PHPUnit_Extensions_SeleniumTestCase |
assertSelectRegExp() | assertSelectRegExp("#binder .name", "/Mike|Derek/", true, $xml); // any? | PHPUnit_Framework_Assert |
assertSelected() | Asserts that a specific label is selected. | PHPUnit_Extensions_SeleniumTestCase |
assertStringEndsNotWith() | Asserts that a string ends not with a given prefix. | PHPUnit_Framework_Assert |
assertStringEndsWith() | Asserts that a string ends with a given prefix. | PHPUnit_Framework_Assert |
assertStringEqualsFile() | Asserts that the contents of a string is equal | PHPUnit_Framework_Assert |
assertStringMatchesFormat() | Asserts that a string matches a given format string. | PHPUnit_Framework_Assert |
assertStringMatchesFormatFile() | Asserts that a string matches a given format file. | PHPUnit_Framework_Assert |
assertStringNotEqualsFile() | Asserts that the contents of a string is not equal | PHPUnit_Framework_Assert |
assertStringNotMatchesFormat() | Asserts that a string does not match a given format string. | PHPUnit_Framework_Assert |
assertStringNotMatchesFormatFile() | Asserts that a string does not match a given format string. | PHPUnit_Framework_Assert |
assertStringStartsNotWith() | Asserts that a string starts not with a given prefix. | PHPUnit_Framework_Assert |
assertStringStartsWith() | Asserts that a string starts with a given prefix. | PHPUnit_Framework_Assert |
assertTag() | Evaluate an HTML or XML string and assert its structure and/or contents. | PHPUnit_Framework_Assert |
assertThat() | Evaluates a PHPUnit_Framework_Constraint matcher object. | PHPUnit_Framework_Assert |
assertTrue() | Asserts that a condition is true. | PHPUnit_Framework_Assert |
assertType() | Asserts that a variable is of a given type. | PHPUnit_Framework_Assert |
assertXmlFileEqualsXmlFile() | Asserts that two XML files are equal. | PHPUnit_Framework_Assert |
assertXmlFileNotEqualsXmlFile() | Asserts that two XML files are not equal. | PHPUnit_Framework_Assert |
assertXmlStringEqualsXmlFile() | Asserts that two XML documents are equal. | PHPUnit_Framework_Assert |
assertXmlStringEqualsXmlString() | Asserts that two XML documents are equal. | PHPUnit_Framework_Assert |
assertXmlStringNotEqualsXmlFile() | Asserts that two XML documents are not equal. | PHPUnit_Framework_Assert |
assertXmlStringNotEqualsXmlString() | Asserts that two XML documents are not equal. | PHPUnit_Framework_Assert |
at() | Returns a matcher that matches when the method it is evaluated for | PHPUnit_Framework_TestCase |
atLeastOnce() | Returns a matcher that matches when the method it is evaluated for | PHPUnit_Framework_TestCase |
attribute() | Returns a PHPUnit_Framework_Constraint_Attribute matcher object. | PHPUnit_Framework_Assert |
attributeEqualTo() | Returns a PHPUnit_Framework_Constraint_IsEqual matcher object | PHPUnit_Framework_Assert |
classHasAttribute() | Returns a PHPUnit_Framework_Constraint_ClassHasAttribute matcher object. | PHPUnit_Framework_Assert |
classHasStaticAttribute() | Returns a PHPUnit_Framework_Constraint_ClassHasStaticAttribute matcher | PHPUnit_Framework_Assert |
contains() | Returns a PHPUnit_Framework_Constraint_TraversableContains matcher | PHPUnit_Framework_Assert |
containsOnly() | Returns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher | PHPUnit_Framework_Assert |
count() | Counts the number of test cases executed by run(TestResult result). | PHPUnit_Framework_TestCase |
equalTo() | Returns a PHPUnit_Framework_Constraint_IsEqual matcher object. | PHPUnit_Framework_Assert |
exactly() | Returns a matcher that matches when the method it is evaluated for | PHPUnit_Framework_TestCase |
fail() | Fails a test with the given message. | PHPUnit_Framework_Assert |
fileExists() | Returns a PHPUnit_Framework_Constraint_FileExists matcher object. | PHPUnit_Framework_Assert |
getAnnotations() | Returns the annotations for this test. | PHPUnit_Framework_TestCase |
getCount() | Return the current assertion count. | PHPUnit_Framework_Assert |
getExpectedException() | PHPUnit_Framework_TestCase | |
getFixtureData() | 返回the named fixture data | CWebTestCase |
getFixtureManager() | 返回the database fixture manager | CWebTestCase |
getFixtureRecord() | 返回the ActiveRecord instance corresponding to the specified alias in the named fixture. False is returned if there is no such fixture or the record cannot be found. | CWebTestCase |
getMock() | Returns a mock object for the specified class. | PHPUnit_Framework_TestCase |
getMockBuilder() | Returns a builder object to create mock objects using a fluent interface. | PHPUnit_Framework_TestCase |
getMockForAbstractClass() | Returns a mock object for the specified abstract class with all abstract | PHPUnit_Framework_TestCase |
getName() | Gets the name of a TestCase. | PHPUnit_Framework_TestCase |
getNumAssertions() | Returns the number of assertions performed by this test. | PHPUnit_Framework_TestCase |
getResult() | PHPUnit_Framework_TestCase | |
getStatus() | Returns the status of this test. | PHPUnit_Framework_TestCase |
getStatusMessage() | Returns the status message of this test. | PHPUnit_Framework_TestCase |
getTestResultObject() | PHPUnit_Framework_TestCase | |
greaterThan() | Returns a PHPUnit_Framework_Constraint_GreaterThan matcher object. | PHPUnit_Framework_Assert |
greaterThanOrEqual() | Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps | PHPUnit_Framework_Assert |
hasFailed() | Returns whether or not this test has failed. | PHPUnit_Framework_TestCase |
identicalTo() | Returns a PHPUnit_Framework_Constraint_IsIdentical matcher object. | PHPUnit_Framework_Assert |
isEmpty() | Returns a PHPUnit_Framework_Constraint_IsEmpty matcher object. | PHPUnit_Framework_Assert |
isFalse() | Returns a PHPUnit_Framework_Constraint_IsFalse matcher object. | PHPUnit_Framework_Assert |
isInstanceOf() | Returns a PHPUnit_Framework_Constraint_IsInstanceOf matcher object. | PHPUnit_Framework_Assert |
isNull() | Returns a PHPUnit_Framework_Constraint_IsNull matcher object. | PHPUnit_Framework_Assert |
isTrue() | Returns a PHPUnit_Framework_Constraint_IsTrue matcher object. | PHPUnit_Framework_Assert |
isType() | Returns a PHPUnit_Framework_Constraint_IsType matcher object. | PHPUnit_Framework_Assert |
lessThan() | Returns a PHPUnit_Framework_Constraint_LessThan matcher object. | PHPUnit_Framework_Assert |
lessThanOrEqual() | Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps | PHPUnit_Framework_Assert |
logicalAnd() | Returns a PHPUnit_Framework_Constraint_And matcher object. | PHPUnit_Framework_Assert |
logicalNot() | Returns a PHPUnit_Framework_Constraint_Not matcher object. | PHPUnit_Framework_Assert |
logicalOr() | Returns a PHPUnit_Framework_Constraint_Or matcher object. | PHPUnit_Framework_Assert |
logicalXor() | Returns a PHPUnit_Framework_Constraint_Xor matcher object. | PHPUnit_Framework_Assert |
markTestIncomplete() | Mark the test as incomplete. | PHPUnit_Framework_Assert |
markTestSkipped() | Mark the test as skipped. | PHPUnit_Framework_Assert |
matches() | Returns a PHPUnit_Framework_Constraint_StringMatches matcher object. | PHPUnit_Framework_Assert |
matchesRegularExpression() | Returns a PHPUnit_Framework_Constraint_PCREMatch matcher object. | PHPUnit_Framework_Assert |
never() | Returns a matcher that matches when the method it is evaluated for | PHPUnit_Framework_TestCase |
objectHasAttribute() | Returns a PHPUnit_Framework_Constraint_ObjectHasAttribute matcher object. | PHPUnit_Framework_Assert |
onConsecutiveCalls() | PHPUnit_Framework_TestCase | |
once() | Returns a matcher that matches when the method it is evaluated for | PHPUnit_Framework_TestCase |
readAttribute() | Returns the value of an attribute of a class or an object. | PHPUnit_Framework_Assert |
resetCount() | Reset the assertion counter. | PHPUnit_Framework_Assert |
returnArgument() | PHPUnit_Framework_TestCase | |
returnCallback() | PHPUnit_Framework_TestCase | |
returnValue() | PHPUnit_Framework_TestCase | |
run() | Runs the test case and collects the results in a TestResult object. | PHPUnit_Extensions_SeleniumTestCase |
runBare() | Runs the bare test sequence. | PHPUnit_Framework_TestCase |
runDefaultAssertions() | PHPUnit_Extensions_SeleniumTestCase | |
runSelenese() | Runs a test from a Selenese (HTML) specification. | PHPUnit_Extensions_SeleniumTestCase |
setBackupGlobals() | Calling this method in setUp() has no effect! | PHPUnit_Framework_TestCase |
setBackupStaticAttributes() | Calling this method in setUp() has no effect! | PHPUnit_Framework_TestCase |
setDependencies() | Sets the dependencies of a TestCase. | PHPUnit_Framework_TestCase |
setDependencyInput() | Sets | PHPUnit_Framework_TestCase |
setExpectedException() | 设置 | PHPUnit_Framework_TestCase |
setInIsolation() | 设置 | PHPUnit_Framework_TestCase |
setName() | Sets the name of a TestCase. | PHPUnit_Framework_TestCase |
setPreserveGlobalState() | 设置 | PHPUnit_Framework_TestCase |
setResult() | 设置 | PHPUnit_Framework_TestCase |
setRunTestInSeparateProcess() | 设置 | PHPUnit_Framework_TestCase |
setUpBeforeClass() | This method is called before the first test of this test class is run. | PHPUnit_Framework_TestCase |
setUseErrorHandler() | 设置 | PHPUnit_Framework_TestCase |
setUseoutputBuffering() | 设置 | PHPUnit_Framework_TestCase |
stringContains() | Returns a PHPUnit_Framework_Constraint_StringContains matcher object. | PHPUnit_Framework_Assert |
stringEndsWith() | Returns a PHPUnit_Framework_Constraint_StringEndsWith matcher object. | PHPUnit_Framework_Assert |
stringStartsWith() | Returns a PHPUnit_Framework_Constraint_StringStartsWith matcher object. | PHPUnit_Framework_Assert |
suite() | PHPUnit_Extensions_SeleniumTestCase | |
syntheticFail() | Fails a test with a synthetic error. | PHPUnit_Framework_Assert |
tearDownAfterClass() | This method is called after the last test of this test class is run. | PHPUnit_Framework_TestCase |
throwException() | PHPUnit_Framework_TestCase | |
toString() | Returns a string representation of the test case. | PHPUnit_Extensions_SeleniumTestCase |
受保护方法
方法 | 描述 | 定义在 |
---|---|---|
assertPostConditions() | Performs assertions shared by all tests of a test case. | PHPUnit_Framework_TestCase |
assertPreConditions() | Performs assertions shared by all tests of a test case. | PHPUnit_Framework_TestCase |
createResult() | Creates a default TestResult object. | PHPUnit_Framework_TestCase |
dataToString() | PHPUnit_Framework_TestCase | |
defaultAssertions() | Template Method that is called after Selenium actions. | PHPUnit_Extensions_SeleniumTestCase |
explodeDirectories() | PHPUnit_Extensions_SeleniumTestCase | |
findDirectorySeparator() | PHPUnit_Extensions_SeleniumTestCase | |
getCodeCoverage() | PHPUnit_Extensions_SeleniumTestCase | |
getDataSetAsString() | Gets the data set description of a TestCase. | PHPUnit_Framework_TestCase |
getDriver() | PHPUnit_Extensions_SeleniumTestCase | |
getMockClass() | Mocks the specified class and returns the name of the mocked class. | PHPUnit_Framework_TestCase |
getMockFromWsdl() | Returns a mock object based on the given WSDL file. | PHPUnit_Framework_TestCase |
getSeleneseFiles() | PHPUnit_Extensions_SeleniumTestCase | |
handleDependencies() | PHPUnit_Framework_TestCase | |
iniSet() | This method is a wrapper for the ini_set() function that automatically | PHPUnit_Framework_TestCase |
matchLocalAndRemotePaths() | PHPUnit_Extensions_SeleniumTestCase | |
onNotSuccessfulTest() | This method is called when a test method did not execute successfully. | PHPUnit_Extensions_SeleniumTestCase |
prepareTemplate() | Performs custom preparations on the process isolation template. | PHPUnit_Framework_TestCase |
runTest() | PHPUnit_Extensions_SeleniumTestCase | |
setExpectedExceptionFromAnnotation() | PHPUnit_Framework_TestCase | |
setLocale() | This method is a wrapper for the setlocale() function that automatically | PHPUnit_Framework_TestCase |
setUp() | Sets up the fixture before executing a test method. | CWebTestCase |
setUseErrorHandlerFromAnnotation() | PHPUnit_Framework_TestCase | |
setUseOutputBufferingFromAnnotation() | PHPUnit_Framework_TestCase | |
tearDown() | Tears down the fixture, for example, close a network connection. | PHPUnit_Framework_TestCase |
verifyMockObjects() | Verifies the mock object expectations. | PHPUnit_Framework_TestCase |
属性详细
a list of fixtures that should be loaded before each test method executes. The array keys are fixture names, and the array values are either AR class names or table names. If table names, they must begin with a colon character (e.g. 'Post' means an AR class, while ':Post' means a table name). Defaults to false, meaning fixtures will not be used at all.
方法详细
public mixed __call(string $name, string $params)
| ||
$name | string | method name |
$params | string | method parameters |
{return} | mixed | the property value |
public function __call($name,$params)
{
if(is_array($this->fixtures) && isset($params[0]) && ($record=$this->getFixtureManager()->getRecord($name,$params[0]))!==false)
return $record;
else
return parent::__call($name,$params);
}
PHP magic method. This method is overridden so that named fixture ActiveRecord instances can be accessed in terms of a method call.
public mixed __get(string $name)
| ||
$name | string | the property name |
{return} | mixed | the property value |
public function __get($name)
{
if(is_array($this->fixtures) && ($rows=$this->getFixtureManager()->getRows($name))!==false)
return $rows;
else
throw new Exception("Unknown property '$name' for class '".get_class($this)."'.");
}
PHP magic method. This method is overridden so that named fixture data can be accessed like a normal property.
public array getFixtureData(string $name)
| ||
$name | string | the fixture name (the key value in fixtures). |
{return} | array | the named fixture data |
public function getFixtureData($name)
{
return $this->getFixtureManager()->getRows($name);
}
public CDbFixtureManager getFixtureManager()
| ||
{return} | CDbFixtureManager | the database fixture manager |
public function getFixtureManager()
{
return Yii::app()->getComponent('fixture');
}
public CActiveRecord getFixtureRecord(string $name, string $alias)
| ||
$name | string | the fixture name (the key value in fixtures). |
$alias | string | the alias of the fixture data row |
{return} | CActiveRecord | the ActiveRecord instance corresponding to the specified alias in the named fixture. False is returned if there is no such fixture or the record cannot be found. |
public function getFixtureRecord($name,$alias)
{
return $this->getFixtureManager()->getRecord($name,$alias);
}
protected void setUp()
|
protected function setUp()
{
parent::setUp();
if(is_array($this->fixtures))
$this->getFixtureManager()->load($this->fixtures);
}
Sets up the fixture before executing a test method. If you override this method, make sure the parent implementation is invoked. Otherwise, the database fixtures will not be managed properly.