Comments: on this page. Click to read or post your own.

Class SapphireTest

Description

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.

Located in /sapphire/dev/SapphireTest.php (line 14)

PHPUnit_Framework_TestCase
   |
   --SapphireTest
Direct descendents
Class Description
SSViewerTest Test case class for the Sapphire framework.
PhpSyntaxTest Test the syntax of the PHP files with various settings
ControllerTest Test case class for the Sapphire framework.
ObjectTest
SQLQueryTest Test case class for the Sapphire framework.
UploadTest
FileTest Tests for the File class
YamlFixtureTest Test case class for the Sapphire framework.
CSSContentParserTest
SiteTreeTest
ObjectStaticTest Tests various static getter and setter methods on Object
ErrorPageTest Test case class for the Sapphire framework.
HTTPRequestTest Test case class for the Sapphire framework.
RequestHandlingTest Tests for RequestHandler and HTTPRequest.
i18nTest
i18nTextCollectorTest
HTTPTest Tests the HTTP class
ClassInfoTest
MemberTest
CsvBulkLoaderTest
CSVParserTest Test case class for the Sapphire framework.
DataObjectDecoratorTest Test case class for the Sapphire framework.
DataObjectTest
SQLFormatterTest
DropdownFieldTest
TableFieldTest Test case class for the Sapphire framework.
FormFieldTest
FieldSetTest Tests for FieldSet
CheckboxSetFieldTest Test case class for the Sapphire framework.
RequirementsTest
DateFieldTest
FormScaffolderTest Tests for DataObject FormField scaffolding
TableListFieldTest Test case class for the Sapphire framework.
CompositeFieldTest
TokenisedRegularExpressionTest
RestfulServiceTest Test case class for the Sapphire framework.
RestfulServerTest
RSSFeedTest
SoapModelAccessTest
DirectorTest
RootURLControllerTest
ModelAsControllerTest
DateTest
HTMLTextTest
DBFieldTest Test case class for the Sapphire framework.
TextTest
PercentageTest
CurrencyTest
SearchContextTest Test case class for the Sapphire framework.
DataObjectSetTest
DatabaseTest
ArrayDataTest Test case class for the Sapphire framework.
ManifestBuilderTest
FunctionalTest Sapphire-specific testing object designed to support functional testing of your web app. It simulates get/post requests, form submission, and can validate resulting HTML, looking up content by CSS selector.
CMSMenuTest
CMSMainTest Test case class for the Sapphire framework.
Variable Summary
Method Summary
static void create_temp_db ()
static void delete_all_temp_dbs ()
static void is_running_test ()
static void kill_temp_db ()
static void using_temp_db ()
A allFixtureIDs ( $className)
An assertEmailSent ($to $to, [$from $from = null], [$subject $subject = null], [$content $content = null])
void clearEmails ()
An findEmail ($to $to, [$from $from = null], [$subject $subject = null], [$content $content = null])
void idFromFixture ($className $className, $identifier $identifier)
void loadFixture ($fixtureFile $fixtureFile)
void objFromFixture ($className $className, $identifier $identifier)
void setUp ()
void tearDown ()
Variables
static mixed $is_running_test = false (line 29)
  • access: protected
YamlFixture $fixture (line 38)
  • access: protected
mixed $fixtureDictionary (line 89)

Array of

  • access: protected
mixed $mailer (line 27)
  • access: protected
mixed $originalIsRunningTest (line 25)
  • access: protected
mixed $originalMailer (line 22)
  • access: protected
mixed $originalMemberPasswordValidator (line 23)
  • access: protected
mixed $originalRequirements (line 24)
  • access: protected
Methods
static method create_temp_db (line 227)
  • todo: Make this db agnostic
static void create_temp_db ()
static method delete_all_temp_dbs (line 244)
static void delete_all_temp_dbs ()
static method is_running_test (line 31)
  • access: public
static void is_running_test ()
static method kill_temp_db (line 212)
  • todo: Make this db agnostic
static void kill_temp_db ()
static method using_temp_db (line 204)

Returns true if we are currently using a temporary database

static void using_temp_db ()
allFixtureIDs (line 107)

Return all of the IDs in the fixture of a particular class name.

  • return: map of fixture-identifier => object-id
  • access: protected
A allFixtureIDs ( $className)
  • $className
assertEmailSent (line 183)

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.

  • return: array containing the keys: 'type','to','from','subject','content', 'plainContent','attachedFiles','customHeaders','htmlContent',inlineImages'
An assertEmailSent ($to $to, [$from $from = null], [$subject $subject = null], [$content $content = null])
  • $to $to
  • $from $from
  • $subject $subject
  • $content $content
clearEmails (line 157)

Clear the log of emails sent

void clearEmails ()
findEmail (line 170)

Search for an email that was sent.

All of the parameters can either be a string, or, if they start with "/", a PREG-compatible regular expression.

  • return: array containing the keys: 'type','to','from','subject','content', 'plainContent','attachedFiles','customHeaders','htmlContent',inlineImages'
An findEmail ($to $to, [$from $from = null], [$subject $subject = null], [$content $content = null])
  • $to $to
  • $from $from
  • $subject $subject
  • $content $content
idFromFixture (line 97)

Get the ID of an object from the fixture.

  • access: protected
void idFromFixture ($className $className, $identifier $identifier)
  • $className $className: The data class, as specified in your fixture file. Parent classes won't work
  • $identifier $identifier: The identifier string, as provided in your fixture file
loadFixture (line 129)

Load a YAML fixture file into the database.

Once loaded, you can use idFromFixture() and objFromFixture() to get items from the fixture

void loadFixture ($fixtureFile $fixtureFile)
  • $fixtureFile $fixtureFile: The location of the .yml fixture file, relative to the site base dir
objFromFixture (line 118)

Get an object from the fixture.

  • access: protected
void objFromFixture ($className $className, $identifier $identifier)
  • $className $className: The data class, as specified in your fixture file. Parent classes won't work
  • $identifier $identifier: The identifier string, as provided in your fixture file
blog comments powered by Disqus

Documentation generated on Mon, 23 Mar 2009 06:56:05 +1300 by phpDocumentor 1.3.2