Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
FunctionalDoiExportTest Class Reference
Inheritance diagram for FunctionalDoiExportTest:
FunctionalImportExportBaseTestCase WebTestCase FunctionalDataciteExportTest FunctionalMedraExportTest

Public Attributes

 $pluginId
 

Protected Member Functions

 assertConfigurationError ($exportPages, $expectedErrorMessage=null)
 
 assertXml ($files, $xml)
 
 checkDoiRegistration ($doi, $sampleFile, $expectedTargetUrl=null)
 
 checkThatPublisherIsJournalName ($xml)
 
 cleanXml ($xml)
 
 configurePlugin ($settings=array())
 
 doExportObjectTest ($objectType, $objectIds, $exportPlugin, $sampleFiles, $singleTest=false)
 
 fakeRouter ($host=null)
 
 getAffectedTables ()
 
 getSampleFileLocation ($fileName)
 
 removeRegisteredDois ($pluginName)
 
 setUp ($doiPrefix)
 
 tearDown ()
 
 testConfigurationError ($exportPages)
 
 testExpectJournalNameAsPublisher ()
 
 testExportAndRegisterObjectsViaCli ($exportPlugin, $command, $exportObjectType, $objectIds, $xmlFiles=null)
 
 testExportUnregisteredDois ($exportPlugin, $objects, $xmlFiles)
 
 testNonExistentJournalPathCliError ($exportPlugin)
 
 testNonExistentObjectIdCliError ($exportPlugin)
 
 testObjectsWithoutDOICannotBeSelectedForExport ($exportPages)
 
 testOutputFileNotWritableCliError ($exportPlugin)
 
 testPluginSettings ($tests, $inputTypes)
 
 testRegisterOrExportSpecificObjects ($pluginName, $objectTypes, $testAccount, $testReset=false)
 
 testRegisterUnregisteredDois ($pluginName, $expectedObjectCaptions, $testAccount)
 
 testUnsupportedObjectTypeCliError ($exportPlugin)
 
- Protected Member Functions inherited from FunctionalImportExportBaseTestCase
 executeCLI ($pluginName, $args)
 
 extractTarFile ($tarFile)
 
 getDomOnExport ($pluginUrl)
 
 getXmlOnExport ($pluginUrl, $postParams=array())
 
 getXpathOnExport ($pluginUrl)
 
 instantiatePlugin ($pluginName)
 
- Protected Member Functions inherited from WebTestCase
 getAffectedTables ()
 
 improveException ($e, $testObject)
 
 logIn ()
 
 setUp ()
 
 tearDown ()
 
 verified ()
 
 verifyAndOpen ($url)
 

Detailed Description

Base class to test DOI export plug-ins.

Definition at line 24 of file FunctionalDoiExportTest.inc.php.

Member Function Documentation

FunctionalDoiExportTest::assertConfigurationError (   $exportPages,
  $expectedErrorMessage = null 
)
protected

Test configuration error.

Parameters
$exportPagesarray
$expectedErrorMessagestring

Definition at line 880 of file FunctionalDoiExportTest.inc.php.

References WebTestCase\improveException().

Referenced by FunctionalMedraExportTest\testConfigurationError(), and testConfigurationError().

FunctionalDoiExportTest::assertXml (   $files,
  $xml 
)
protected
FunctionalDoiExportTest::checkDoiRegistration (   $doi,
  $sampleFile,
  $expectedTargetUrl = null 
)
protected

Check whether the given DOI resolves correctly to the given target URL and has the meta-data from the sample file registered.

Parameters
$objectTypestring
$sampleFilestring
$expectedTargetUrlstring

Definition at line 815 of file FunctionalDoiExportTest.inc.php.

FunctionalDoiExportTest::checkThatPublisherIsJournalName (   $xml)
protected

Check whether the publisher has been correctly replaced by the journal name.

Parameters
$xmlstring
Returns
string

Definition at line 788 of file FunctionalDoiExportTest.inc.php.

Referenced by assertXml().

FunctionalDoiExportTest::cleanXml (   $xml)
protected

Normalize the XML.

Parameters
$xmlstring
Returns
string

Definition at line 734 of file FunctionalDoiExportTest.inc.php.

Referenced by assertXml().

FunctionalDoiExportTest::doExportObjectTest (   $objectType,
  $objectIds,
  $exportPlugin,
  $sampleFiles,
  $singleTest = false 
)
protected

SCENARIO OUTLINE: Export OJS object(s).

GIVEN I navigate to the {export plug-in}'s settings page AND I configure {options} (if any) AND I assign a DOI to one or more OJS objects of type {object type} with {object id(s)} AND I navigate to that/these object(s) in the {export plug-in} WHEN I click the "Export" button THEN the object(s) will be exported as a {export format} similarly to the example(s) given in {sample file(s)}.

EXAMPLES: See sub-classes.

Definition at line 164 of file FunctionalDoiExportTest.inc.php.

References assertXml(), and FunctionalImportExportBaseTestCase\getXmlOnExport().

Referenced by FunctionalDataciteExportTest\testExportArticle(), FunctionalDataciteExportTest\testExportGalley(), FunctionalDataciteExportTest\testExportIssue(), FunctionalMedraExportTest\testExportSerialArticleAsManifestation(), FunctionalMedraExportTest\testExportSerialArticleAsWork(), FunctionalMedraExportTest\testExportSerialIssueAsManifestation(), FunctionalMedraExportTest\testExportSerialIssueAsWork(), and FunctionalDataciteExportTest\testExportSuppFile().

FunctionalDoiExportTest::fakeRouter (   $host = null)
protected
FunctionalDoiExportTest::getAffectedTables ( )
protected
FunctionalDoiExportTest::getSampleFileLocation (   $fileName)
protected

Return the path of a sample file relative to the application base directory.

Parameters
$fileNamestring
Returns
string

Definition at line 778 of file FunctionalDoiExportTest.inc.php.

Referenced by assertXml().

FunctionalDoiExportTest::setUp (   $doiPrefix)
protected
See Also
PHPUnit_Framework_TestCase::setUp()

Definition at line 59 of file FunctionalDoiExportTest.inc.php.

References DAORegistry\getDAO(), and PluginRegistry\loadCategory().

FunctionalDoiExportTest::tearDown ( )
protected
See Also
PHPUnit_Framework_TestCase::tearDown()

Definition at line 106 of file FunctionalDoiExportTest.inc.php.

References DAORegistry\getDAO(), and PluginRegistry\loadCategory().

FunctionalDoiExportTest::testConfigurationError (   $exportPages)
protected

SCENARIO OUTLINE: Disable plug-in when .

GIVEN I have {configuration error} WHEN I navigate to the plug-in home page THEN I'll see an error message AND there'll be no links to the export pages.

EXAMPLES: See sub-classes.

Definition at line 522 of file FunctionalDoiExportTest.inc.php.

References assertConfigurationError(), DAORegistry\getDAO(), PluginRegistry\loadCategory(), and WebTestCase\logIn().

FunctionalDoiExportTest::testExpectJournalNameAsPublisher ( )
protected

SCENARIO: missing publisher will be replaced with journal name

GIVEN I did not configure a publisher in journal setup step 1 WHEN I export an object THEN the O4DOI publisher field will be set to the journal name.

Definition at line 140 of file FunctionalDoiExportTest.inc.php.

References DAORegistry\getDAO().

Referenced by FunctionalDataciteExportTest\testExportIssue(), and FunctionalMedraExportTest\testExportSerialIssueAsWork().

FunctionalDoiExportTest::testExportAndRegisterObjectsViaCli (   $exportPlugin,
  $command,
  $exportObjectType,
  $objectIds,
  $xmlFiles = null 
)
protected

SCENARIO OUTLINE: Export objects on the command line.

GIVEN I am in the applications base directory AND I configured the DOI plug-in with {settings} WHEN I enter the following command on the command line: > php tools/importExport.php {export plug-in} \ > export files/test test \ > {export object type} {object ids} THEN files/test.xml or files/test.tar.gz respectively will contain the XML specified in {XML file(s)}.

EXAMPLES: See sub-classes.

SCENARIO OUTLINE: Register objects on the command line.

GIVEN I am in the applications base directory AND I configured the DOI plug-in with {settings} WHEN I enter the following command on the command line: > php tools/importExport.php {export plug-in} \ > register test {export object type} {object ids} THEN the given objects will be registered with the registration agency. AND the script will return "Registration successful".

EXAMPLES: See sub-classes.

Definition at line 577 of file FunctionalDoiExportTest.inc.php.

References assertXml(), FunctionalImportExportBaseTestCase\extractTarFile(), fakeRouter(), Config\getVar(), and WebTestCase\improveException().

FunctionalDoiExportTest::testExportUnregisteredDois (   $exportPlugin,
  $objects,
  $xmlFiles 
)
protected

SCENARIO OUTLINE: Export unregistered DOIs

GIVEN I assign DOIs to several OJS objects BUT I have not yet registered these objects AND I navigate to the "export all unregistered objects" page in the {export plug-in} AND I select {objects} by activating the checkbox next to the object WHEN I click the "Export" button THEN all DOIs of selected unregistered OJS objects will be exported into {XML files} in the given order which will be streamed to the browser as a compressed tar file.

EXAMPLES: See sub-classes.

Definition at line 202 of file FunctionalDoiExportTest.inc.php.

References assertXml(), and FunctionalImportExportBaseTestCase\getXmlOnExport().

FunctionalDoiExportTest::testNonExistentJournalPathCliError (   $exportPlugin)
protected

SCENARIO: non-existent journal (CLI error)

WHEN I enter a non-existent journal path on the CLI command line THEN I'll receive a CLI error "No journal matched the specified journal path: ...."

Definition at line 667 of file FunctionalDoiExportTest.inc.php.

References fakeRouter().

FunctionalDoiExportTest::testNonExistentObjectIdCliError (   $exportPlugin)
protected

SCENARIO: non-existent object id (CLI error)

WHEN I enter a non-existent journal path on the CLI command line THEN I'll receive a CLI error "No journal matched the specified journal path: ...."

Definition at line 710 of file FunctionalDoiExportTest.inc.php.

References fakeRouter().

FunctionalDoiExportTest::testObjectsWithoutDOICannotBeSelectedForExport (   $exportPages)
protected

SCENARIO OUTLINE: Objects without DOIs cannot be selected for export.

GIVEN I configure custom DOIs AND I've not yet assigned a DOI to an object THEN the object will not appear on the corresponding {export page}.

EXAMPLES: See sub-classes.

Definition at line 407 of file FunctionalDoiExportTest.inc.php.

References DAORegistry\getDAO(), WebTestCase\improveException(), PluginRegistry\loadCategory(), and WebTestCase\logIn().

FunctionalDoiExportTest::testOutputFileNotWritableCliError (   $exportPlugin)
protected

SCENARIO: output file not writable (CLI error)

WHEN I enter an output file that is not writable THEN I'll receive a CLI error "The output file ... is not writable."

Definition at line 688 of file FunctionalDoiExportTest.inc.php.

References fakeRouter().

FunctionalDoiExportTest::testPluginSettings (   $tests,
  $inputTypes 
)
protected

SCENARIO: Change plug-in settings.

GIVEN I'm on the settings page WHEN I change the settings AND I click the "Save" button THEN the settings will be stored to the database.

SCENARIO: Display changed plug-in settings.

WHEN I navigate to the settings page THEN I'll see the currently selected settings.

Definition at line 471 of file FunctionalDoiExportTest.inc.php.

References WebTestCase\logIn().

FunctionalDoiExportTest::testRegisterOrExportSpecificObjects (   $pluginName,
  $objectTypes,
  $testAccount,
  $testReset = false 
)
protected

SCENARIO OUTLINE: Register/Export specific objects.

GIVEN I assign a DOI to an OJS {object} that has not been registered with the DOI export plug-in before AND I navigate to the corresponding {export page} in the DOI export plug-in WHEN I click the "{register or export}" button THEN the DOIs of the selected objects will be registered/exported as a new object.

EXAMPLES: See sub-classes.

SCENARIO: Registration notification. GIVEN I clicked the register button on one of the export pages WHEN the registration was successful THEN I'll be redirected to the plug-in's index page AND I'll see a notification "Registration successful" AND the registration button of the registered object(s) will change to "Update".

SCENARIO: Export without registration account. GIVEN I do not have a registration account AND I therefore entered no credentials on the plug-in's configuration page WHEN I navigate to an {export page} THEN I'll not see any "Registration" buttons BUT "Export" still works.

Definition at line 249 of file FunctionalDoiExportTest.inc.php.

References DAORegistry\getDAO(), WebTestCase\improveException(), WebTestCase\logIn(), and removeRegisteredDois().

FunctionalDoiExportTest::testRegisterUnregisteredDois (   $pluginName,
  $expectedObjectCaptions,
  $testAccount 
)
protected

SCENARIO: Register unregistered DOIs - part 1

GIVEN I navigate to the DOI export plug-in home page WHEN I click the "register all unregistered DOIs" button THEN I'll see a list of all unregistered objects AND I'll be presented with an "Export" and a "Register" button.

SCENARIO: Register unregistered DOIs - part 2

GIVEN I am presented with a list of unregistered objects after having clicked the "register all unregistered DOIs" button AND I have selected all objects on that page WHEN I click the "Register" button THEN all DOIs of issues, articles and galleys on that list will be automatically registered with the DOI agency as new objects. AND I'll be redirected to the plug-ins home page AND I'll see a notification 'Registration successful' AND the list with unregistered objects will be empty.

SCENARIO: Export without registration account, see self::testRegisterOrExportSpecificObjects()

Definition at line 351 of file FunctionalDoiExportTest.inc.php.

References DAORegistry\getDAO(), WebTestCase\logIn(), and removeRegisteredDois().

FunctionalDoiExportTest::testUnsupportedObjectTypeCliError (   $exportPlugin)
protected

SCENARIO: unsupported object type (CLI error)

WHEN I enter an unsupported export object type on the CLI command line THEN I'll receive a CLI error "The object type ... cannot be exported."

Definition at line 644 of file FunctionalDoiExportTest.inc.php.

References fakeRouter().

Member Data Documentation

FunctionalDoiExportTest::$pluginId

Other internal test parameters

Definition at line 30 of file FunctionalDoiExportTest.inc.php.


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