diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml
index 82a33f5ef..dff8993bb 100644
--- a/.github/workflows/php.yml
+++ b/.github/workflows/php.yml
@@ -12,17 +12,17 @@ on:
jobs:
build:
- runs-on: ubuntu-22.04
+ runs-on: ubuntu-24.04
strategy:
matrix:
- versions: [{php: '8.1', solr: '9.9.0'}]
+ versions: [{php: '8.1', solr: '9.10.1'}, {php: '8.2', solr: '9.10.1'}]
fail-fast: false
name: PHP ${{ matrix.versions.php }} Test
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v5
- name: Setup PHP ${{ matrix.versions.php }}
uses: shivammathur/setup-php@v2
@@ -40,7 +40,7 @@ jobs:
- name: Get Solr ${{ matrix.versions.solr }} from Cache
id: cache-solr
- uses: actions/cache@v3
+ uses: actions/cache@v5
with:
path: downloads
key: solr-${{ matrix.versions.solr }}
@@ -77,7 +77,7 @@ jobs:
- name: Test-admin
run: php composer.phar test -- --testsuite admin
-
+
- name: Test-security
run: php composer.phar test -- --testsuite security
diff --git a/Vagrantfile b/Vagrantfile
index fb2c3baa0..6aefaf536 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -2,10 +2,10 @@
# vi: set ft=ruby :
$software = <
-
-
-
+
diff --git a/composer.json b/composer.json
index 777fb596d..b3c72befc 100644
--- a/composer.json
+++ b/composer.json
@@ -21,7 +21,7 @@
"ext-readline": "*",
"ext-sockets": "*",
"ext-yaml": "*",
- "opus4/zf1-future": "1.21.*",
+ "opus4/zf1-future": "1.25.0.x-dev as 1.21.4.x-dev",
"jpgraph/jpgraph": "dev-master",
"opus4-repo/opus4-common": "dev-master as 4.8.1",
"opus4-repo/framework": "dev-master as 4.8.1",
diff --git a/library/Application/Console/Collection/AbstractCollectionCommand.php b/library/Application/Console/Collection/AbstractCollectionCommand.php
index f18e857e4..ad5fe8589 100644
--- a/library/Application/Console/Collection/AbstractCollectionCommand.php
+++ b/library/Application/Console/Collection/AbstractCollectionCommand.php
@@ -115,14 +115,14 @@ protected function processOptions(InputInterface $input)
if ($srcRoleName !== null && $srcColNumber !== null) {
$role = CollectionRole::fetchByName($srcRoleName);
if ($role === null) {
- throw new Exception("CollectionRole with name '${srcRoleName}' not found.");
+ throw new Exception("CollectionRole with name '{$srcRoleName}' not found.");
}
$collections = Collection::getModelRepository()->fetchCollectionsByRoleNumber(
$role->getId(),
$srcColNumber
);
if (count($collections) === 0) {
- throw new Exception("No collection found for role '${srcRoleName}' and number '$srcColNumber'.");
+ throw new Exception("No collection found for role '{$srcRoleName}' and number '$srcColNumber'.");
}
$this->sourceCol = $collections[0];
}
@@ -137,14 +137,14 @@ protected function processOptions(InputInterface $input)
if ($destRoleName !== null && $destColNumber !== null) {
$role = CollectionRole::fetchByName($destRoleName);
if ($role === null) {
- throw new Exception("CollectionRole with name '${destRoleName}' not found.");
+ throw new Exception("CollectionRole with name '{$destRoleName}' not found.");
}
$collections = Collection::getModelRepository()->fetchCollectionsByRoleNumber(
$role->getId(),
$destColNumber
);
if (count($collections) === 0) {
- throw new Exception("No collection found for role '${destRoleName}' and number '$destColNumber'.");
+ throw new Exception("No collection found for role '{$destRoleName}' and number '$destColNumber'.");
}
$this->destCol = $collections[0];
}
diff --git a/library/Application/Console/Collection/CopyCommand.php b/library/Application/Console/Collection/CopyCommand.php
index 612642fc9..8294ee418 100644
--- a/library/Application/Console/Collection/CopyCommand.php
+++ b/library/Application/Console/Collection/CopyCommand.php
@@ -75,7 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$sourceCount = count($sourceDocuments);
if ($sourceCount === 0) {
- $output->writeln("Collection (ID = ${sourceId}) does not contain documents.");
+ $output->writeln("Collection (ID = {$sourceId}) does not contain documents.");
$output->writeln('');
$output->writeln(' "' . $sourceCol->getDisplayName() . '"');
$output->writeln('');
@@ -87,15 +87,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$moveCount = count($moveDocuments);
if ($moveCount === 0) {
- $output->writeln("Destination collection already contains all the documents (${sourceCount}) of source collection.");
+ $output->writeln("Destination collection already contains all the documents ({$sourceCount}) of source collection.");
return self::SUCCESS;
}
- $output->writeln("Copy documents (${moveCount}) from source collection (ID = ${sourceId})");
+ $output->writeln("Copy documents ({$moveCount}) from source collection (ID = {$sourceId})");
$output->writeln('');
$output->writeln(' "' . $sourceCol->getDisplayName() . '"');
$output->writeln('');
- $output->writeln("to destination collection (ID = ${destId})");
+ $output->writeln("to destination collection (ID = {$destId})");
$output->writeln('');
$output->writeln(' "' . $destCol->getDisplayName() . '"');
$output->writeln('');
diff --git a/library/Application/Console/Collection/MoveCommand.php b/library/Application/Console/Collection/MoveCommand.php
index 9670d913e..d9a05d2fa 100644
--- a/library/Application/Console/Collection/MoveCommand.php
+++ b/library/Application/Console/Collection/MoveCommand.php
@@ -75,18 +75,18 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$sourceCount = count($sourceDocuments);
if ($sourceCount === 0) {
- $output->writeln("Collection (ID = ${sourceId}) does not contain documents.");
+ $output->writeln("Collection (ID = {$sourceId}) does not contain documents.");
$output->writeln('');
$output->writeln(' "' . $sourceCol->getDisplayName() . '"');
$output->writeln('');
return self::SUCCESS;
}
- $output->writeln("Move documents (${sourceCount}) from source collection (ID = ${sourceId})");
+ $output->writeln("Move documents ({$sourceCount}) from source collection (ID = {$sourceId})");
$output->writeln('');
$output->writeln(' "' . $sourceCol->getDisplayName() . '"');
$output->writeln('');
- $output->writeln("to destination collection (ID = ${destId})");
+ $output->writeln("to destination collection (ID = {$destId})");
$output->writeln('');
$output->writeln(' "' . $destCol->getDisplayName() . '"');
$output->writeln('');
diff --git a/library/Application/Console/Collection/RemoveCommand.php b/library/Application/Console/Collection/RemoveCommand.php
index adea74888..106458aa6 100644
--- a/library/Application/Console/Collection/RemoveCommand.php
+++ b/library/Application/Console/Collection/RemoveCommand.php
@@ -210,7 +210,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$targetCount = count($targetDocuments);
if ($targetCount === 0) {
- $output->writeln("Collection (ID = ${targetId}) does not contain documents.");
+ $output->writeln("Collection (ID = {$targetId}) does not contain documents.");
$output->writeln('');
$output->writeln(' "' . $targetCol->getDisplayName() . '"');
$output->writeln('');
@@ -220,7 +220,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$removeDocuments = null;
if ($filterCol === null) {
- $output->writeln("Remove all documents (${targetCount}) from collection (ID = ${targetId})");
+ $output->writeln("Remove all documents ({$targetCount}) from collection (ID = {$targetId})");
$output->writeln('');
$output->writeln(' "' . $targetCol->getDisplayName() . '"');
$output->writeln('');
@@ -231,7 +231,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$filterCount = count($filterDocuments);
if ($filterCount === 0) {
- $output->writeln("The filter collection (ID = ${filterId}) does not contain any documents.");
+ $output->writeln("The filter collection (ID = {$filterId}) does not contain any documents.");
$output->writeln('');
$output->writeln(' "' . $filterCol->getDisplayName() . '"');
$output->writeln('');
@@ -242,22 +242,22 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$removeCount = count($removeDocuments);
if ($removeCount === 0) {
- $output->writeln("Non of the documents in the filter collection (ID = ${filterId})");
+ $output->writeln("Non of the documents in the filter collection (ID = {$filterId})");
$output->writeln('');
$output->writeln(' "' . $filterCol->getDisplayName() . '"');
$output->writeln('');
- $output->writeln("are present in the target collection (ID= ${targetId})");
+ $output->writeln("are present in the target collection (ID= {$targetId})");
$output->writeln('');
$output->writeln(' "' . $targetCol->getDisplayName() . '"');
$output->writeln('');
return self::FAILURE;
}
- $output->writeln("Remove documents (${filterCount}) in collection (ID = ${filterId})");
+ $output->writeln("Remove documents ({$filterCount}) in collection (ID = {$filterId})");
$output->writeln('');
$output->writeln(' "' . $filterCol->getDisplayName() . '"');
$output->writeln('');
- $output->writeln("from collection (ID= ${targetId})");
+ $output->writeln("from collection (ID= {$targetId})");
$output->writeln('');
$output->writeln(' "' . $targetCol->getDisplayName() . '"');
$output->writeln('');
diff --git a/library/Application/Controller/Plugin/SecurityRealm.php b/library/Application/Controller/Plugin/SecurityRealm.php
index 409e394b7..94effc112 100644
--- a/library/Application/Controller/Plugin/SecurityRealm.php
+++ b/library/Application/Controller/Plugin/SecurityRealm.php
@@ -40,6 +40,9 @@
*/
class Application_Controller_Plugin_SecurityRealm extends Zend_Controller_Plugin_Abstract
{
+ /** @var array */
+ private $groups;
+
/**
* Determine the current User's security role and set up Realm.
*
diff --git a/library/Application/Util/BrowsingParams.php b/library/Application/Util/BrowsingParams.php
index 5a82fef7d..3f43a6a16 100644
--- a/library/Application/Util/BrowsingParams.php
+++ b/library/Application/Util/BrowsingParams.php
@@ -34,6 +34,9 @@ class Application_Util_BrowsingParams
/** @var Zend_Controller_Request_Http */
private $request;
+ /** @var Zend_Log */
+ private $log;
+
/**
* @param Zend_Controller_Request_Http $request
* @param Zend_Log $log
diff --git a/tests/bin/install_solr_docker.sh b/tests/bin/install_solr_docker.sh
index 64e2ab971..959c80446 100755
--- a/tests/bin/install_solr_docker.sh
+++ b/tests/bin/install_solr_docker.sh
@@ -58,7 +58,7 @@ cd ../solr-$SOLR_VERSION
./bin/solr start -force --user-managed
./bin/solr create -c opus4
cd server/solr/opus4/conf/
-rm -f managed-schema schema.xml solrconfig.xml
+rm -f *
ln -s ../../../../../vendor/opus4-repo/search/conf/schema.xml schema.xml
ln -s ../../../../../vendor/opus4-repo/search/conf/solrconfig.xml solrconfig.xml
cd ../../../../
diff --git a/tests/library/Application/Console/Collection/MoveCommandTest.php b/tests/library/Application/Console/Collection/MoveCommandTest.php
index 15a12a80e..3a1fae133 100644
--- a/tests/library/Application/Console/Collection/MoveCommandTest.php
+++ b/tests/library/Application/Console/Collection/MoveCommandTest.php
@@ -157,7 +157,7 @@ public function testMoveDocumentsFromEmptyCollection()
$colId1 = $col2->getId();
- $this->assertStringContainsString("Collection (ID = ${colId1}) does not contain documents.", $output);
+ $this->assertStringContainsString("Collection (ID = {$colId1}) does not contain documents.", $output);
}
public function testCollectionIdNotFound()
@@ -217,7 +217,7 @@ public function testSourceCollectionUsingUnknownColNumberNotFound()
$this->assertCount(0, $col2->getDocumentIds());
$this->expectException(Exception::class);
- $this->expectExceptionMessage("No collection found for role '${roleName}' and number 'col3'.");
+ $this->expectExceptionMessage("No collection found for role '{$roleName}' and number 'col3'.");
$this->tester->execute([
'--no-interaction' => true,
@@ -265,7 +265,7 @@ public function testDestinationCollectionUsingUnknownColNumberNotFound()
$this->assertCount(0, $col2->getDocumentIds());
$this->expectException(Exception::class);
- $this->expectExceptionMessage("No collection found for role '${roleName}' and number 'col3'.");
+ $this->expectExceptionMessage("No collection found for role '{$roleName}' and number 'col3'.");
$this->tester->execute([
'--no-interaction' => true,
diff --git a/tests/modules/ControllerTestCaseTest.php b/tests/modules/ControllerTestCaseTest.php
index 183b70013..a66903190 100644
--- a/tests/modules/ControllerTestCaseTest.php
+++ b/tests/modules/ControllerTestCaseTest.php
@@ -179,13 +179,6 @@ public function testDisableEnableTranslation()
$translator = Application_Translate::getInstance();
$this->assertFalse($translator->isTranslated('LastName'));
-
- $this->enableTranslation();
-
- $translator = Application_Translate::getInstance();
- $this->assertTrue($translator->isTranslated('LastName'));
-
- $this->assertSame($defaultTranslator, $translator);
}
public function testGetWorkspacePath()
diff --git a/tests/modules/admin/forms/Document/NoteTest.php b/tests/modules/admin/forms/Document/NoteTest.php
index 9c5633268..b0ce6572a 100644
--- a/tests/modules/admin/forms/Document/NoteTest.php
+++ b/tests/modules/admin/forms/Document/NoteTest.php
@@ -37,6 +37,9 @@
*/
class Admin_Form_Document_NoteTest extends ControllerTestCase
{
+ /** @var string[] */
+ protected $additionalResources = ['database'];
+
public function testCreateForm()
{
$form = new Admin_Form_Document_Note();
diff --git a/tests/modules/frontdoor/controllers/IndexControllerTest.php b/tests/modules/frontdoor/controllers/IndexControllerTest.php
index e29dd2875..c8e08acbe 100644
--- a/tests/modules/frontdoor/controllers/IndexControllerTest.php
+++ b/tests/modules/frontdoor/controllers/IndexControllerTest.php
@@ -1586,11 +1586,11 @@ public function testRenderingGndSubjectLink()
$config = $this->getConfig();
$gndLinkUrl = $config->gnd->baseUrl . '4130303-9';
- $this->dispatch("/frontdoor/index/index/docId/${docId}");
+ $this->dispatch("/frontdoor/index/index/docId/{$docId}");
- $this->assertXpath("//a[@href=\"${gndLinkUrl}\"]");
+ $this->assertXpath("//a[@href=\"{$gndLinkUrl}\"]");
$this->assertXpathContentContains('//em[contains(@class,"subject")]', 'Bauhaus');
- $this->assertXpathContentContains("//a[@href=\"${gndLinkUrl}\"]", 'GND');
+ $this->assertXpathContentContains("//a[@href=\"{$gndLinkUrl}\"]", 'GND');
$this->assertXpathContentContains('//em[contains(@class, "subject")]', 'mytag');
$this->assertNotXpathContentContains('//a', 'mytag'); // no link for 'mytag'
diff --git a/tests/modules/frontdoor/models/AuthorsTest.php b/tests/modules/frontdoor/models/AuthorsTest.php
index 4d473500e..1db737d06 100644
--- a/tests/modules/frontdoor/models/AuthorsTest.php
+++ b/tests/modules/frontdoor/models/AuthorsTest.php
@@ -236,7 +236,7 @@ public function testGetContactableAuthorsNoAuthors()
$author->setFirstName('John');
$author->setLastName('Doe');
$author->setEmail('doe@example.org');
- $this->authorId = $author->store();
+ $author->store();
$linkPerson = $doc->addPersonAuthor($author);
$linkPerson->setAllowEmailContact(false);
diff --git a/tests/modules/oai/models/DocumentListTest.php b/tests/modules/oai/models/DocumentListTest.php
index 29e6a7656..5f5fa124c 100644
--- a/tests/modules/oai/models/DocumentListTest.php
+++ b/tests/modules/oai/models/DocumentListTest.php
@@ -76,9 +76,9 @@ public function testIntervalOAIPMHQueries()
$file = $this->createOpusTestFile('article.txt');
$file->setVisibleInOai(1);
$doc->addFile($file);
- $this->docId = $doc->store();
+ $docId = $doc->store();
- $doc = Document::get($this->docId);
+ $doc = Document::get($docId);
$serverDateModified = $doc->getServerDateModified();
$today = new DateTime();
@@ -120,8 +120,8 @@ public function testIntervalOAIPMHQueries()
$docIds = $docListModel->query($oaiRequest);
$this->assertTrue(
- in_array($this->docId, $docIds),
- "Response must contain document id $this->docId: " . var_export($interval, true)
+ in_array($docId, $docIds),
+ "Response must contain document id {$docId}: " . var_export($interval, true)
);
}
}
@@ -134,9 +134,9 @@ public function testIntervalOAIPMHQueryWithoutTestDoc()
{
$doc = $this->createTestDocument();
$doc->setServerState('published');
- $this->docId = $doc->store();
+ $docId = $doc->store();
- $doc = Document::get($this->docId);
+ $doc = Document::get($docId);
$serverDateModified = $doc->getServerDateModified();
$today = new DateTime();
@@ -179,7 +179,7 @@ public function testIntervalOAIPMHQueryWithoutTestDoc()
$docListModel = new Oai_Model_DocumentList($server);
$docIds = $docListModel->query($oaiRequest);
- $this->assertFalse(in_array($this->docId, $docIds), "Response must NOT contain document id $this->docId: " . var_export($interval, true));
+ $this->assertFalse(in_array($docId, $docIds), "Response must NOT contain document id {$docId}: " . var_export($interval, true));
}
}
diff --git a/tests/modules/rss/controllers/IndexControllerTest.php b/tests/modules/rss/controllers/IndexControllerTest.php
index 489daf72c..05a537d1f 100644
--- a/tests/modules/rss/controllers/IndexControllerTest.php
+++ b/tests/modules/rss/controllers/IndexControllerTest.php
@@ -69,7 +69,7 @@ public function testUnavailableSolrServerReturns503()
$this->dispatch('/rss/index/index/searchtype/all');
$body = $this->getResponse()->getBody();
- $this->assertStringNotContainsString("http://${host}:${port}/solr/corethatdoesnotexist", $body);
+ $this->assertStringNotContainsString("http://{$host}:{$port}/solr/corethatdoesnotexist", $body);
$this->assertStringContainsString("The search service is currently not available.", $body);
$this->assertResponseCode(503);
diff --git a/tests/modules/solrsearch/controllers/BrowseControllerTest.php b/tests/modules/solrsearch/controllers/BrowseControllerTest.php
index 9a9986852..f3b79b8e1 100644
--- a/tests/modules/solrsearch/controllers/BrowseControllerTest.php
+++ b/tests/modules/solrsearch/controllers/BrowseControllerTest.php
@@ -305,7 +305,7 @@ public function testUnavailableServiceReturnsHttpCode503()
$this->dispatch('/solrsearch/browse/doctypes');
$body = $this->getResponse()->getBody();
- // $this->assertStringNotContainsString("http://${host}:${port}/solr/corethatdoesnotexist", $body);
+ // $this->assertStringNotContainsString("http://{$host}:{$port}/solr/corethatdoesnotexist", $body);
$this->assertStringContainsString("exception 'Application_SearchException' with message 'error_search_unavailable'", $body);
$this->assertResponseCode(503);
}
diff --git a/tests/modules/solrsearch/controllers/IndexControllerTest.php b/tests/modules/solrsearch/controllers/IndexControllerTest.php
index d93efdabb..30aad05f9 100644
--- a/tests/modules/solrsearch/controllers/IndexControllerTest.php
+++ b/tests/modules/solrsearch/controllers/IndexControllerTest.php
@@ -720,7 +720,7 @@ public function testUnavailableSolrServerReturns503()
$this->dispatch('/solrsearch/browse/doctypes');
$body = $this->getResponse()->getBody();
- $this->assertStringNotContainsString("http://${host}:${port}/solr/corethatdoesnotexist", $body);
+ $this->assertStringNotContainsString("http://{$host}:{$port}/solr/corethatdoesnotexist", $body);
$this->assertStringContainsString('The search service is currently not available.', $body);
$this->assertResponseCode(503);
}
diff --git a/tests/support/ControllerTestCase.php b/tests/support/ControllerTestCase.php
index e29f0fb0e..8759861f2 100644
--- a/tests/support/ControllerTestCase.php
+++ b/tests/support/ControllerTestCase.php
@@ -36,6 +36,7 @@
use Opus\Common\DocumentInterface;
use Opus\Common\File;
use Opus\Common\FileInterface;
+use Opus\Common\Log\LogService;
use Opus\Common\LoggingTrait;
use Opus\Common\Model\ModelException;
use Opus\Common\Model\ModelInterface;
@@ -81,9 +82,6 @@ class ControllerTestCase extends TestCase
/** @var array */
private $tempFiles = [];
- /** @var Application_Translate|null */
- private $translatorBackup;
-
/** @var string */
private $workspacePath;
@@ -1095,31 +1093,19 @@ public function setBaseUrl($baseUrl)
*/
public function disableTranslation()
{
- if ($this->translatorBackup === null) {
- $this->translatorBackup = Application_Translate::getInstance();
- }
+ $logService = LogService::getInstance();
+ $logger = $logService->getLog('translation');
$translate = new Application_Translate([
'adapter' => 'array',
'content' => [],
'locale' => 'auto',
+ 'log' => $logger,
]);
Application_Translate::setInstance($translate);
}
- /**
- * Resets translations with original (bootstrap) translation object.
- *
- * This function restores translation if disableTranslation has been called before.
- */
- public function enableTranslation()
- {
- if ($this->translatorBackup !== null) {
- Application_Translate::setInstance($this->translatorBackup);
- }
- }
-
/**
* Allow the given user (identified by his or her name) to access the given module.
* Returns true if access permission was added; otherwise false.
diff --git a/tests/support/CrudControllerTestCase.php b/tests/support/CrudControllerTestCase.php
index fe894d0c8..b12fa9d18 100644
--- a/tests/support/CrudControllerTestCase.php
+++ b/tests/support/CrudControllerTestCase.php
@@ -72,8 +72,6 @@ public function setUp(): void
$this->createsModels = false;
- $this->licences = [];
-
$models = $this->getModels();
foreach ($models as $model) {