From 59b25c3021838196d1839a165863dbdd50bf89fc Mon Sep 17 00:00:00 2001 From: haogatyp Date: Tue, 10 Oct 2023 18:24:53 +0200 Subject: [PATCH] #766 Removed unnecessary mock test class and moved remaining mock test class back to the support folder. --- tests/Bootstrap.php | 1 - .../oai/models/MockDefaultOaiServer.php | 34 ------------------- tests/modules/oai/models/OaiConfigTest.php | 4 +-- .../modules/oai/models/ServerFactoryTest.php | 11 +++--- .../MockXMetaDissPlusServer.php | 0 5 files changed, 7 insertions(+), 43 deletions(-) delete mode 100644 tests/modules/oai/models/MockDefaultOaiServer.php rename tests/{modules/oai/models => support}/MockXMetaDissPlusServer.php (100%) diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 78d7fd340..8a50c34e2 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -42,7 +42,6 @@ // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, [ - APPLICATION_PATH . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'oai'. DIRECTORY_SEPARATOR . 'models', APPLICATION_PATH . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'support', // Support-Klassen fuer Tests APPLICATION_PATH . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'library', // tests/library APPLICATION_PATH . DIRECTORY_SEPARATOR . 'library', // Server library diff --git a/tests/modules/oai/models/MockDefaultOaiServer.php b/tests/modules/oai/models/MockDefaultOaiServer.php deleted file mode 100644 index c54c6642d..000000000 --- a/tests/modules/oai/models/MockDefaultOaiServer.php +++ /dev/null @@ -1,34 +0,0 @@ - [ 'default' => [ - 'class' => MockDefaultOaiServer::class, + 'class' => Oai_Model_Prefix_Oai_OaiDcServer::class, 'viewHelpers' => 'optionValue, fileUrl, frontdoorUrl, transferUrl, dcmiType, dcType, openAireType', 'xsltFile' => 'oaiFile.xslt', ], @@ -88,7 +88,7 @@ public function testGetDefaults() 'resumptionTokenPath' => '/vagrant/tests/workspace/tmp/resumption', 'emailContact' => 'opus4ci@example.org', 'xsltFile' => 'oaiFile.xslt', - 'class' => MockDefaultOaiServer::class, + 'class' => Oai_Model_Prefix_Oai_OaiDcServer::class, 'viewHelpers' => 'optionValue, fileUrl, frontdoorUrl, transferUrl, dcmiType, dcType, openAireType', ]; diff --git a/tests/modules/oai/models/ServerFactoryTest.php b/tests/modules/oai/models/ServerFactoryTest.php index 9b9eac980..c54888598 100644 --- a/tests/modules/oai/models/ServerFactoryTest.php +++ b/tests/modules/oai/models/ServerFactoryTest.php @@ -53,9 +53,8 @@ protected function getTestConfiguration() ], 'format' => [ 'default' => [ - 'class' => MockDefaultOaiServer::class, + 'class' => Oai_Model_Prefix_Oai_OaiDcServer::class, 'viewHelpers' => 'optionValue, fileUrl, frontdoorUrl, transferUrl, dcmiType, dcType, openAireType', - 'xsltFile' => 'oaiFile.xslt', 'hasFilesVisibleInOai' => 1, ], 'copy_xml' => [ @@ -102,7 +101,7 @@ public function testCreate() $serverFactory = new Oai_Model_ServerFactory(); $serverFactory->setOaiConfig($this->getOaiConfig()); $server = $serverFactory->create(); - $this->assertEquals(MockDefaultOaiServer::class, get_class($server)); + $this->assertEquals(Oai_Model_Prefix_Oai_OaiDcServer::class, get_class($server)); } public function testCreateWithMetadataPrefix() @@ -118,7 +117,7 @@ public function testCreateWithUnknownMetadataPrefix() $serverFactory = new Oai_Model_ServerFactory(); $serverFactory->setOaiConfig($this->getOaiConfig()); $server = $serverFactory->create('unknownPrefix'); - $this->assertEquals(MockDefaultOaiServer::class, get_class($server)); + $this->assertEquals(Oai_Model_Prefix_Oai_OaiDcServer::class, get_class($server)); } public function testCreateWithNoFormatConfiguration() @@ -184,7 +183,7 @@ public function testDefaultServerOptionsWithDefaultConfiguration() 'maxListRecords' => 10, 'resumptionTokenPath' => '/vagrant/tests/workspace/tmp/resumption', 'emailContact' => 'opus4ci@example.org', - 'xsltFile' => 'oaiFile.xslt', + 'xsltFile' => 'oai_dc.xslt', 'documentStatesAllowed' => ['published', 'deleted'], 'viewHelpers' => ['optionValue', 'fileUrl', 'frontdoorUrl', 'transferUrl', 'dcmiType', 'dcType', 'openAireType', 'listMetadataFormats'], 'notEmbargoedOn' => false, @@ -194,7 +193,7 @@ public function testDefaultServerOptionsWithDefaultConfiguration() 'checkEmbargo' => false, ]; - $this->assertEquals(MockDefaultOaiServer::class, get_class($server)); + $this->assertEquals(Oai_Model_Prefix_Oai_OaiDcServer::class, get_class($server)); $this->assertEquals($expectedOptions, $server->getOptions(array_keys($expectedOptions))); } diff --git a/tests/modules/oai/models/MockXMetaDissPlusServer.php b/tests/support/MockXMetaDissPlusServer.php similarity index 100% rename from tests/modules/oai/models/MockXMetaDissPlusServer.php rename to tests/support/MockXMetaDissPlusServer.php