Class SapphireTest
Test case class for the Sapphire framework. Sapphire unit testing is based on PHPUnit, but provides a number of hooks into our data model that make it easier to work with.
- PHPUnit_Framework_TestCase
-
SapphireTest
Direct known subclasses
Methods summary
public static
|
|
public
|
|
public
|
#
setUpOnce( )
Called once per test case ( |
public
|
|
protected
integer
|
|
protected
A
|
#
allFixtureIDs( string $className )
Return all of the IDs in the fixture of a particular class name. Will collate all IDs form all fixtures if multiple fixtures are provided. |
protected
|
|
public
|
#
loadFixture( mixed $fixtureFile )
Load a YAML fixture file into the database. Once loaded, you can use idFromFixture() and objFromFixture() to get items from the fixture. Doesn't clear existing fixtures. |
public
|
#
clearFixtures( )
Clear all fixtures which were previously loaded through |
public
|
|
public
|
|
public
An
|
|
public
An
|
#
assertEmailSent( mixed $to, mixed $from = null, mixed $subject = null, mixed $content = null )
Assert that the matching email was sent since the last call to clearEmails() All of the parameters can either be a string, or, if they start with "/", a PREG-compatible regular expression. |
public
|
#
assertDOSContains( mixed $matches, mixed $dataObjectSet )
Assert that the given |
public
|
#
assertDOSEquals( mixed $matches, mixed $dataObjectSet )
Assert that the given |
public
|
#
assertDOSAllMatch( mixed $match, mixed $dataObjectSet )
Assert that the every record in the given |
public static
|
|
public static
|
|
public static
|
|
public static
|
|
public static
|
|
public
|
|
public
|
#
logInWithPermission( mixed $permCode = "ADMIN" )
Create a member and group with the given permission code, and log in with it. Returns the member ID. |
Magic methods summary
Properties summary
public static
string|array
|
$fixture_file |
#
Path to fixture data for this test run. If passed as an array, multiple fixture files will be loaded. Please note that you won't be able to refer with "=>" notation between the fixtures, they act independent of each other. |
protected
mixed
|
$originalMailer | |
protected
mixed
|
$originalMemberPasswordValidator | |
protected
mixed
|
$originalRequirements | |
protected
mixed
|
$originalIsRunningTest | |
protected
mixed
|
$originalTheme | |
protected
mixed
|
$originalNestedURLsState | |
protected
mixed
|
$mailer | |
protected static
boolean
|
$is_running_test | |
protected
array
|
$requireDefaultRecordsFrom |
#
By default, setUp() does not require default records. Pass class names in here, and the require/augment default records function will be called on them. |
protected
array
|
$illegalExtensions |
#
A list of extensions that can't be applied during the execution of this run. If they are applied, they will be temporarily removed and a database migration called. |
protected
array
|
$requiredExtensions |
#
A list of extensions that must be applied during the execution of this run. If they are not applied, they will be temporarily added and a database migration called. |
protected
array
|
$extraDataObjects |
#
By default, the test database won't contain any DataObjects that have the interface TestOnly. This variable lets you define additional TestOnly DataObjects to set up for this test. Set it to an array of DataObject subclass names. |
protected
boolean
|
$backupGlobals |
#
We need to disabling backing up of globals to avoid overriding the few globals SilverStripe relies on, like $lang for the i18n subsystem. |
protected
array
|
$fixtures |
#
$fixtures Array of |
protected
mixed
|
$fixtureDictionary |
#
Array |
protected
array
|
$cache_generatedMembers |
#
Cache for logInWithPermission() |