23 import(
'tests.functional.plugins.importexport.FunctionalDoiExportTest');
24 import(
'plugins.importexport.medra.MedraExportPlugin');
32 protected function setUp() : void {
33 $this->pluginId =
'medra';
42 if (empty($baseUrl) || empty($medraPassword)) {
43 $this->markTestSkipped(
44 'Please set webtest_base_url and webtest_medra_pw in your ' .
45 'config.php\'s [debug] section to the base url of your test server ' .
46 'and the password of your Medra test account.'
51 'index' => $baseUrl .
'/index.php/test/manager/importexport/plugin/MedraExportPlugin',
52 'settings' => $baseUrl .
'/index.php/test/manager/plugin/importexport/MedraExportPlugin/settings'
55 $this->defaultPluginSettings = array(
56 'username' => self::TEST_ACCOUNT,
57 'password' => $medraPassword,
58 'registrantName' =>
'Registrant',
59 'fromCompany' =>
'From Company',
60 'fromName' =>
'From Person',
61 'fromEmail' =>
'from@email.com',
62 'publicationCountry' =>
'US',
63 'exportIssuesAs' => O4DOI_ISSUE_AS_WORK
66 parent::setUp(
'1749');
81 $this->removeRegisteredDois(
'MedraExportPlugin');
82 $this->configurePlugin(array(
'exportIssuesAs' => O4DOI_ISSUE_AS_WORK));
83 $this->doTestExpectJournalNameAsPublisher();
84 $this->doExportObjectTest(
'issue', 1,
'MedraExportPlugin',
'serial-issue-as-work.xml');
93 self::assertContains(
'<PublisherName>test</PublisherName>', $xml);
97 '<PublisherName>test</PublisherName>',
98 '<PublisherName>Test Publisher</PublisherName>',
113 $this->removeRegisteredDois(
'MedraExportPlugin');
114 $this->configurePlugin(array(
'exportIssuesAs' => O4DOI_ISSUE_AS_MANIFESTATION));
115 $this->doExportObjectTest(
'issue', 1,
'MedraExportPlugin',
'serial-issue-as-manifestation.xml');
128 $this->removeRegisteredDois(
'MedraExportPlugin');
129 $this->configurePlugin(array(
'exportIssuesAs' => O4DOI_ISSUE_AS_WORK));
130 $this->doExportObjectTest(
'article', 1,
'MedraExportPlugin',
'serial-article-as-work-1.xml');
144 $this->removeRegisteredDois(
'MedraExportPlugin');
145 $this->configurePlugin(array(
'exportIssuesAs' => O4DOI_ISSUE_AS_MANIFESTATION));
146 $this->doExportObjectTest(
'galley', 1,
'MedraExportPlugin',
'serial-article-as-manifestation-1.xml',
true);
147 $this->doExportObjectTest(
'galley', array(1,2,3),
'MedraExportPlugin',
'serial-article-as-manifestation-2.xml',
true);
160 $this->removeRegisteredDois(
'MedraExportPlugin');
161 $this->configurePlugin(array(
'exportIssuesAs' => O4DOI_ISSUE_AS_MANIFESTATION));
165 $pluginInstance = $this->instantiatePlugin(
'MedraExportPlugin');
166 $hookName =
'submissiondao::getAdditionalFieldNames';
169 $testObject = $submissionDao->getById(1);
170 $testObject->setData(
'medra::' . DOI_EXPORT_REGDOI,
'1749/t.v1i1.1');
171 $submissionDao->updateObject($testObject);
175 foreach($hooks[$hookName] as $index => $hook) {
176 if (is_a($hook[0],
'MedraExportPlugin')) {
177 unset($hooks[$hookName][$index]);
185 'galley' => array(1,2,3)
188 'serial-article-as-work-2.xml',
189 'serial-article-as-manifestation-2.xml',
190 'serial-issue-as-manifestation.xml'
192 parent::testExportUnregisteredDois(
'MedraExportPlugin', $objects, $xmlFiles);
224 parent::testRegisterOrExportSpecificObjects(
'MedraExportPlugin', array(
'issue',
'article',
'galley'), self::TEST_ACCOUNT,
true);
232 parent::testRegisterUnregisteredDois(
'MedraExportPlugin', array(
'Issue',
'Article',
'Galley'), self::TEST_ACCOUNT);
249 foreach(array(
'index',
'articles',
'galleys',
'all') as $pageName) {
250 $this->open($this->pages[$pageName]);
251 $this->assertElementPresent(
'//a[@href="http://www.medra.org/en/metadata_td.htm"]');
268 parent::testObjectsWithoutDOICannotBeSelectedForExport(array(
'issues',
'articles',
'galleys',
'all'));
278 'fromCompany' =>
'FromComp1',
279 'fromName' =>
'FromName1',
280 'fromEmail' =>
'from@email.us',
281 'registrantName' =>
'Registrant1',
282 'publicationCountry' =>
'US',
283 'exportIssuesAs' => O4DOI_ISSUE_AS_WORK
286 'fromCompany' =>
'FromComp2',
287 'fromName' =>
'FromName2',
288 'fromEmail' =>
'from@email.de',
289 'registrantName' =>
'Registrant2',
290 'publicationCountry' =>
'DE',
291 'exportIssuesAs' => O4DOI_ISSUE_AS_MANIFESTATION
295 'fromCompany' => TEST_INPUTTYPE_TEXT,
296 'fromName' => TEST_INPUTTYPE_TEXT,
297 'fromEmail' => TEST_INPUTTYPE_EMAIL,
298 'registrantName' => TEST_INPUTTYPE_TEXT,
299 'publicationCountry' => TEST_INPUTTYPE_SELECT,
300 'exportIssuesAs' => TEST_INPUTTYPE_SELECT
302 parent::testPluginSettings($tests, $inputTypes);
316 $exportPages = array(
'issues',
'articles',
'galleys',
'all');
317 parent::testConfigurationError($exportPages);
321 $pluginSettingsDao->updateSetting(1, $this->pluginId .
'exportplugin',
'registrantName',
'');
322 $this->assertConfigurationError($exportPages,
'The plug-in is not fully set up');
340 $this->removeRegisteredDois(
'MedraExportPlugin');
342 array(O4DOI_ISSUE_AS_WORK,
'issues',
'1',
'serial-issue-as-work.xml'),
343 array(O4DOI_ISSUE_AS_MANIFESTATION,
'issues',
'1',
'serial-issue-as-manifestation.xml'),
344 array(O4DOI_ISSUE_AS_WORK,
'articles',
'1',
'serial-article-as-work-1.xml'),
345 array(O4DOI_ISSUE_AS_MANIFESTATION,
'galleys',
'1',
'serial-article-as-manifestation-1.xml'),
346 array(O4DOI_ISSUE_AS_MANIFESTATION,
'galleys',
'1 2 3',
'serial-article-as-manifestation-2.xml')
349 foreach($examples as $example) {
350 list($exportIssuesAs, $exportObjectType, $objectIds, $xmlFile) = $example;
353 $this->configurePlugin(array(
'exportIssuesAs' => $exportIssuesAs));
355 parent::testExportAndRegisterObjectsViaCli(
'MedraExportPlugin',
'export', $exportObjectType, $objectIds, $xmlFile);
356 parent::testExportAndRegisterObjectsViaCli(
'MedraExportPlugin',
'register', $exportObjectType, $objectIds);
357 $this->removeRegisteredDois(
'MedraExportPlugin');
366 parent::testUnsupportedObjectTypeCliError(
'MedraExportPlugin');
374 parent::testNonExistentJournalPathCliError(
'MedraExportPlugin');
382 parent::testOutputFileNotWritableCliError(
'MedraExportPlugin');
390 parent::testNonExistentObjectIdCliError(
'MedraExportPlugin');
410 return parent::cleanXml($xml);