16 require_mock_env(
'env1');
18 import(
'lib.pkp.classes.core.PKPRouter');
19 import(
'lib.pkp.tests.functional.plugins.importexport.FunctionalImportExportBaseTestCase');
22 private $expectedDois = array(
23 'Issue' =>
'10.1234/t.v1i1-imp-test',
24 'Submission' =>
'10.1234/t.v1i1.1-imp-test',
25 'Galley' =>
'10.1234/t.v1i1.1.g1-imp-test',
27 private $expectedURNs = array(
28 'Issue' =>
'urn:nbn:de:0000-t.v1i1-imp-test8',
29 'Submission' =>
'urn:nbn:de:0000-t.v1i1.1-imp-test5',
30 'Galley' =>
'urn:nbn:de:0000-t.v1i1.1.g1-imp-test5',
38 'submissions',
'submission_files',
'submission_galleys',
'publication_galley_settings',
'submission_search_object_keywords',
39 'submission_search_objects',
'submission_settings',
40 'authors',
'custom_issue_orders',
'custom_section_orders',
'event_log',
'event_log_settings',
41 'issue_settings',
'issues',
'sessions',
'temporary_files',
'users'
48 protected function setUp() : void {
51 if (is_null($request->getRouter())) {
53 $request->setRouter($router);
58 $testfile =
'tests/functional/plugins/importexport/native/testissue.xml';
59 $args = array(
'import', $testfile,
'test',
'admin');
60 $result = $this->executeCli(
'NativeImportExportPlugin', $args);
61 self::assertRegExp(
'/##plugins.importexport.native.import.success.description##/', $result);
64 'Issue' =>
'IssueDAO',
65 'Submission' =>
'SubmissionDAO',
66 'Galley' =>
'ArticleGalleyDAO',
69 foreach ($daos as $objectType => $daoName) {
71 $pubObject = call_user_func(array($dao,
"get${objectType}ByPubId"),
'doi', $this->expectedDois[$objectType]);
72 self::assertNotNull($pubObject,
"Error while testing $objectType: object or DOI has not been imported.");
73 $pubObjectByURN = call_user_func(array($dao,
"get${objectType}ByPubId"),
'other::urn', $this->expectedURNs[$objectType]);
74 self::assertNotNull($pubObjectByURN,
"Error while testing $objectType: object or URN has not been imported.");
75 if ($objectType ==
'Submission') {
76 $articleId = $pubObject->getId();
81 $args = array(
'import', $testfile,
'test',
'admin');
82 $result = $this->executeCli(
'NativeImportExportPlugin', $args);
83 self::assertRegExp(
'/##plugins.importexport.native.import.error.duplicatePubId##/', $result);
87 $context = $request->getContext();
88 import(
'lib.pkp.classes.file.SubmissionFileManager');
90 $submissionFileManager->rmtree($submissionFileManager->getBasePath());
94 $testfile =
'tests/functional/plugins/importexport/native/testissue-with-errors.xml';
95 $args = array(
'import', $testfile,
'test',
'admin');
96 $result = $this->executeCli(
'NativeImportExportPlugin', $args);
97 self::assertRegExp(
'/##plugins.importexport.native.import.error.unknownPubId##/', $result);