Open Journal Systems
3.3.0
|
Public Member Functions | |
getActualOutput () | |
Data Fields | |
$mockedRegistryKeys = array() | |
$registryBackup = array() | |
Protected Member Functions | |
getMockedDAOs () | |
getMockedRegistryKeys () | |
mockRequest ($path='index/test-page/test-op', $userId=null) | |
setTestConfiguration ($config, $configPath='config') | |
setUp () | |
tearDown () | |
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 27 of file PKPTestCase.inc.php.
PKPTestCase::getActualOutput | ( | ) |
Definition at line 98 of file PKPTestCase.inc.php.
|
protected |
Override this method if you want to backup/restore DAOs before/after the test.
Reimplemented in PKPNotificationManagerTest, ArticleSearchTest, OAIMetadataFormat_DCTest, ArticleSearchIndexTest, ValidatorControlledVocabTest, and FormValidatorControlledVocabTest.
Definition at line 38 of file PKPTestCase.inc.php.
Referenced by setUp(), and tearDown().
|
protected |
Override this method if you want to backup/restore registry entries before/after the test.
Reimplemented in OAIMetadataFormat_DCTest, PolicyTestCase, PluginTestCase, and DispatcherTest.
Definition at line 47 of file PKPTestCase.inc.php.
References $mockedRegistryKeys.
Referenced by setUp(), and tearDown().
|
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.
$path | string |
$userId | int |
Definition at line 143 of file PKPTestCase.inc.php.
References $application, Registry\delete(), Registry\get(), and PKPApplication\get().
|
protected |
Set a non-default test configuration
$config | string the id of the configuration to use |
$configPath | string (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 113 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(), PKPComponentRouterTest\testUrlWithoutPathinfoAndOverriddenBaseUrl(), PKPPageRouterTest\testUrlWithoutPathinfoAndOverriddenBaseUrl(), PKPComponentRouterTest\testUrlWithoutPathinfoAndSecondContextObjectIsNull(), PKPPageRouterTest\testUrlWithoutPathinfoAndSecondContextObjectIsNull(), PKPPageRouterTest\testUrlWithPathinfo(), PKPComponentRouterTest\testUrlWithPathinfo(), PKPPageRouterTest\testUrlWithPathinfoAndOverriddenBaseUrl(), PKPComponentRouterTest\testUrlWithPathinfoAndOverriddenBaseUrl(), and PKPPageRouterTest\testUrlWithPathinfoAndOverriddenNewContext().
|
protected |
Reimplemented in PKPNotificationManagerTest, FileCacheTest, MetadataDescriptionTest, ArticleSearchTest, DispatcherTest, ArticleSearchIndexTest, PKPRouterTestCase, DatabaseTestCase, PKPRequestTest, PKPPageRouterTest, FilterDAOTest, UsageStatsLoaderTest, DataObjectTest, FormValidatorArrayCustomTest, FormValidatorTest, PKPComponentRouterTest, AuthorizationDecisionManagerTest, MedraWebserviceTest, and PublicationTest.
Definition at line 54 of file PKPTestCase.inc.php.
References Registry\get(), Core\getBaseDir(), DAORegistry\getDAO(), getMockedDAOs(), getMockedRegistryKeys(), and Config\setConfigFileName().
|
protected |
Reimplemented in ArticleSearchTest, DatabaseTestCase, ArticleSearchIndexTest, PKPRouterTestCase, PKPRequestTest, PublicationTest, and XMLTypeDescriptionTest.
Definition at line 83 of file PKPTestCase.inc.php.
References getMockedDAOs(), getMockedRegistryKeys(), DAORegistry\registerDAO(), and Registry\set().
PKPTestCase::$mockedRegistryKeys = array() |
Definition at line 31 of file PKPTestCase.inc.php.
Referenced by getMockedRegistryKeys().
PKPTestCase::$registryBackup = array() |
Definition at line 30 of file PKPTestCase.inc.php.