Permalink
Browse files

Added getFixtureData() and getFixtureRecord() to CDbTestCase and CWeb…

…TestCase
  • Loading branch information...
1 parent 189a7ff commit 91930c0a4b2fd14ca596cf2d8292b394ab8cf3f6 qiang.xue committed Oct 29, 2009
Showing with 41 additions and 0 deletions.
  1. +1 −0 CHANGELOG
  2. +20 −0 framework/test/CDbTestCase.php
  3. +20 −0 framework/test/CWebTestCase.php
View
@@ -11,6 +11,7 @@ Version 1.1b to be released
- Enh #570: Improved CSort so that it can support sorting by complex expressions or compound attributes (Qiang)
- Enh #597: Added support for modifying primary key of an AR instance by calling save() directly (Qiang)
- Enh #622: Added support for using HTML button tags in form builder (Qiang)
+- Enh: Added getFixtureData() and getFixtureRecord() to CDbTestCase and CWebTestCase (Qiang)
- Chg #574: session ID is no longer hashed for CDbHttpSession (Qiang)
- New #633: Added support to allow using customized locale data (Qiang)
- New: Added support for using table prefixes (Qiang)
@@ -85,6 +85,26 @@ public function getFixtureManager()
}
/**
+ * @param string the fixture name (the key value in {@link fixtures}).
+ * @return array the named fixture data
+ */
+ public function getFixtureData($name)
+ {
+ return $this->getFixtureManager()->getRows($name);
+ }
+
+ /**
+ * @param string the fixture name (the key value in {@link fixtures}).
+ * @param 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);
+ }
+
+ /**
* 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.
@@ -70,6 +70,26 @@ public function getFixtureManager()
}
/**
+ * @param string the fixture name (the key value in {@link fixtures}).
+ * @return array the named fixture data
+ */
+ public function getFixtureData($name)
+ {
+ return $this->getFixtureManager()->getRows($name);
+ }
+
+ /**
+ * @param string the fixture name (the key value in {@link fixtures}).
+ * @param 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);
+ }
+
+ /**
* 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.

0 comments on commit 91930c0

Please sign in to comment.