Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
PKPTestCase Class Reference
Inheritance diagram for PKPTestCase:
AuthorizationPolicyTest CitationListTokenizerFilterTest ClassTypeDescriptionTest ConfigTest DatabaseTestCase DataObjectTest DispatcherTest FileCacheTest FilterHelperTest FilterTest FormValidatorAlphaNumTest FormValidatorArrayCustomTest FormValidatorArrayTest FormValidatorBooleanTest FormValidatorControlledVocabTest FormValidatorCustomTest FormValidatorEmailTest FormValidatorInSetTest FormValidatorLengthTest FormValidatorLocaleEmailTest FormValidatorLocaleTest FormValidatorPostTest FormValidatorRegExpTest FormValidatorTest FormValidatorUriTest FormValidatorUrlTest HandlerValidatorRolesTest JSONTest MetadataDescriptionDummyAdapterTest MetadataDescriptionTest MetadataPropertyTest MetadataTypeDescriptionTest Nlm30CitationSchemaCitationAdapterTest Nlm30CitationSchemaCitationOutputFormatFilterTest Nlm30CitationSchemaFilterTestCase Nlm30NameSchemaPersonStringFilterTest Nlm30Openurl10CrosswalkFilterTest Nlm30XmlFilterTestCase PersonStringNlm30NameSchemaFilterTest PKPLocaleTest PKPNotificationManagerTest PKPRequestTest PKPRouterTestCase PolicySetTest PolicyTestCase PrimitiveTypeDescriptionTest StringTest TypeDescriptionFactoryTest ValidatorControlledVocabTest ValidatorDateTest ValidatorEmailTest ValidatorISSNTest ValidatorTypeDescriptionTest ValidatorUrlTest XMLTypeDescriptionTest

Public Member Functions

 getActualOutput ()
 

Protected Member Functions

 getMockedDAOs ()
 
 getMockedRegistryKeys ()
 
 mockRequest ($path= 'index/test-page/test-op', $userId=null)
 
 setTestConfiguration ($config, $configPath= 'config')
 
 setUp ()
 
 tearDown ()
 

Detailed Description

Class that implements functionality common to all PKP unit test cases.

NB: PHPUnit 3.x requires PHP 5.2 or later so we can use PHP5 constructs.

Definition at line 25 of file PKPTestCase.inc.php.

Member Function Documentation

PKPTestCase::getActualOutput ( )

Definition at line 96 of file PKPTestCase.inc.php.

PKPTestCase::getMockedDAOs ( )
protected

Override this method if you want to backup/restore DAOs before/after the test.

Returns
array A list of DAO names to backup and restore.

Definition at line 36 of file PKPTestCase.inc.php.

Referenced by setUp(), and tearDown().

PKPTestCase::getMockedRegistryKeys ( )
protected

Override this method if you want to backup/restore registry entries before/after the test.

Returns
array A list of registry keys to backup and restore.

Definition at line 45 of file PKPTestCase.inc.php.

Referenced by setUp(), and tearDown().

PKPTestCase::mockRequest (   $path = 'index/test-page/test-op',
  $userId = null 
)
protected

Mock a web request.

For correct timing you have to call this method in the setUp() method of a test after calling parent::setUp() or in a test method. You can also call this method as many times as necessary from within your test and you're guaranteed to receive a fresh request whenever you call it.

And make sure that you merge any additional mocked registry keys with the ones returned from this class.

Parameters
$pathstring
$userIdint
Returns
Request

Definition at line 141 of file PKPTestCase.inc.php.

References Registry\delete(), and Registry\get().

PKPTestCase::setTestConfiguration (   $config,
  $configPath = 'config' 
)
protected

Set a non-default test configuration

Parameters
$configstring the id of the configuration to use
$configPathstring (optional) where to find the config file, default: 'config'
$dbConnect(optional) whether to try to re-connect the data base, default: true

Definition at line 111 of file PKPTestCase.inc.php.

References Config\getConfigFileName(), and Config\setConfigFileName().

Referenced by PKPRequestTest\testGetBaseUrl(), PKPRequestTest\testGetBaseUrlWithHostDetection(), PKPRouterTestCase\testGetIndexUrl(), PKPRouterTestCase\testGetIndexUrlRestful(), PKPRequestTest\testGetRequestPath(), PKPRequestTest\testGetRequestPathRestful(), PKPRequestTest\testGetRequestPathWithoutPathinfo(), PKPRequestTest\testGetRequestPathWithPathinfo(), DBConnectionTest\testInitCustomDBConnection(), DBConnectionTest\testInitPostgresDBConnection(), PKPPageRouterTest\testIsCacheableNotInstalled(), PKPPageRouterTest\testIsCacheableWithoutPathinfo(), PKPPageRouterTest\testIsCacheableWithoutPathinfoSuccess(), PKPPageRouterTest\testIsCacheableWithPathinfo(), PKPPageRouterTest\testIsCacheableWithPathinfoSuccess(), PKPPageRouterTest\testIsCacheableWithPost(), PKPRequestTest\testIsPathInfoEnabled1(), PKPRequestTest\testIsPathInfoEnabled2(), PKPRequestTest\testIsRestfulUrlsEnabled1(), PKPRequestTest\testIsRestfulUrlsEnabled2(), PKPPageRouterTest\testUrlWithoutPathinfoAndOverriddenBaseUrl(), PKPComponentRouterTest\testUrlWithoutPathinfoAndOverriddenBaseUrl(), PKPPageRouterTest\testUrlWithoutPathinfoAndSecondContextObjectIsNull(), PKPComponentRouterTest\testUrlWithoutPathinfoAndSecondContextObjectIsNull(), PKPPageRouterTest\testUrlWithPathinfo(), PKPComponentRouterTest\testUrlWithPathinfo(), PKPPageRouterTest\testUrlWithPathinfoAndOverriddenBaseUrl(), PKPComponentRouterTest\testUrlWithPathinfoAndOverriddenBaseUrl(), and PKPPageRouterTest\testUrlWithPathinfoAndOverriddenNewContext().

PKPTestCase::setUp ( )
protected
PKPTestCase::tearDown ( )
protected

The documentation for this class was generated from the following file: