Skip to content
Snippets Groups Projects
Commit ab67873d authored by Robert Lange's avatar Robert Lange
Browse files

refs #23542 [finc] vf7: fix dds and tests

* update to laminas or remove obsolete dependencies for dds
* fix unit tests
** set Laminas as namespace
** correct signature for setUp method

* fix OpenUrlTest method testValidateParamsEzbFalse by correcting import
** Redi resolver had been removed in finc - caused ReflectionException and made test fail
** corrected namespace
** run test via:
docker exec -it de_15_ubl_php_1 sh -c "vendor/bin/phpunit --configuration module/finc/tests/phpunit.xml module/finc/tests/unit-tests/src/fincTest/View/Helper/Root/OpenUrlTest.php --filter testValidateParamsEzbFalse"
parent 216d822f
Branches
Tags
No related merge requests found
Showing
with 63 additions and 47 deletions
...@@ -17,11 +17,8 @@ ...@@ -17,11 +17,8 @@
"extra": { "extra": {
"vufind": { "vufind": {
"modules": [ "modules": [
"Zend\\Filter", "Laminas\\Filter",
"Zend\\Hydrator", "Laminas\\Validator",
"Zend\\Validator",
"Zend\\Serializer",
"Zend\\InputFilter",
"finc" "finc"
] ]
} }
......
...@@ -19,17 +19,17 @@ ...@@ -19,17 +19,17 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2 * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
*/ */
use Zend\Filter\PregReplace; use Laminas\Filter\PregReplace;
use Zend\Filter\StringTrim; use Laminas\Filter\StringTrim;
use Zend\Form\Element\Email; use Laminas\Form\Element\Email;
use Zend\Form\Element\Select; use Laminas\Form\Element\Select;
use Zend\Form\Element\Submit; use Laminas\Form\Element\Submit;
use Zend\Form\Element\Text; use Laminas\Form\Element\Text;
use Zend\Form\Element\Textarea; use Laminas\Form\Element\Textarea;
use Zend\Validator\EmailAddress; use Laminas\Validator\EmailAddress;
use Zend\Validator\NotEmpty; use Laminas\Validator\NotEmpty;
use Zend\Validator\Regex; use Laminas\Validator\Regex;
use Zend\Validator\StringLength; use Laminas\Validator\StringLength;
return [ return [
'name' => 'dds-form', 'name' => 'dds-form',
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
*/ */
namespace finc\AjaxHandler; namespace finc\AjaxHandler;
use Zend\Mvc\Controller\Plugin\Params; use Laminas\Mvc\Controller\Plugin\Params;
/** /**
* AJAX handler to get statistics (e.g. counts) of users interlibrary loans. * AJAX handler to get statistics (e.g. counts) of users interlibrary loans.
......
...@@ -30,12 +30,12 @@ namespace finc\Controller; ...@@ -30,12 +30,12 @@ namespace finc\Controller;
use finc\Exception\DDS as DDSException; use finc\Exception\DDS as DDSException;
use finc\Mailer\Mailer as Mailer; use finc\Mailer\Mailer as Mailer;
use VuFind\Exception\Mail as MailException;
use Laminas\Form\Element\Select; use Laminas\Form\Element\Select;
use Laminas\Form\Form; use Laminas\Form\Form;
use Laminas\Http\PhpEnvironment\Request; use Laminas\Http\PhpEnvironment\Request;
use Laminas\Mail\Address as Address; use Laminas\Mail\Address as Address;
use Laminas\ServiceManager\ServiceLocatorInterface; use Laminas\ServiceManager\ServiceLocatorInterface;
use VuFind\Exception\Mail as MailException;
/** /**
* Controller for Document Delivery Service * Controller for Document Delivery Service
...@@ -261,8 +261,7 @@ class DocumentDeliveryServiceController extends \VuFind\Controller\AbstractBase ...@@ -261,8 +261,7 @@ class DocumentDeliveryServiceController extends \VuFind\Controller\AbstractBase
->send(); ->send();
if (!$response->isSuccess()) { if (!$response->isSuccess()) {
if ($response->getContent()) { if ($response->getContent() && ($responseArray = $this->parseJsonAsArray($response->getContent()))) {
$responseArray = $this->parseJsonAsArray($response->getContent());
if (array_key_exists('error', $responseArray)) { if (array_key_exists('error', $responseArray)) {
$message = $responseArray['error']; $message = $responseArray['error'];
} }
......
...@@ -26,8 +26,27 @@ ...@@ -26,8 +26,27 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/indexing Wiki * @link https://vufind.org/wiki/indexing Wiki
*/ */
namespace finc\Exception;
// Manipulate command line to load correct route, then run the main index page: // Manipulate command line to load correct route, then run the main index page:
array_unshift($_SERVER['argv'], array_shift($_SERVER['argv']), 'import', 'import-xsl'); array_unshift(
$_SERVER['argv'],
array_shift($_SERVER['argv']),
'import',
'import-xsl'
);
$_SERVER['argc'] += 2; $_SERVER['argc'] += 2;
require_once __DIR__ . '/../public/index.php'; require_once dirname(__FILE__, 6) . '/public/index.php';
/**
* DDS Exception
*
* @category VuFind
* @package Exceptions
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
class DDS extends \Exception
{
}
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
namespace finc\View\Helper\Root; namespace finc\View\Helper\Root;
use finc\Resolver\Driver\Ezb; use finc\Resolver\Driver\Ezb;
use finc\Resolver\Driver\Redi; use VuFind\Resolver\Driver\Redi;
/** /**
* OpenUrl view helper * OpenUrl view helper
......
C:37:"PHPUnit\Runner\DefaultTestResultCache":5538:{a:2:{s:7:"defects";a:1:{s:65:"FincTest\View\Helper\Root\OpenUrlTest::testValidateParamsEzbFalse";i:3;}s:5:"times";a:70:{s:53:"fincTest\Config\SearchSpecsReaderTest::testParentYaml";d:0.442;s:58:"fincTest\Config\SearchSpecsReaderTest::testSearchSpecsRead";d:0.171;s:58:"fincTest\Config\SearchSpecsReaderTest::testMissingFileRead";d:0.001;s:51:"fincTest\Config\SearchSpecsReaderTest::testYamlLoad";d:0.002;s:52:"fincTest\Config\SearchSpecsReaderTest::testYamlMerge";d:0.001;s:50:"VuFindTest\ILS\Driver\PAIATest::testChangePassword";d:0.03;s:40:"VuFindTest\ILS\Driver\PAIATest::testFees";d:0.005;s:41:"VuFindTest\ILS\Driver\PAIATest::testHolds";d:0.004;s:44:"VuFindTest\ILS\Driver\PAIATest::testRequests";d:0.004;s:48:"VuFindTest\ILS\Driver\PAIATest::testTransactions";d:0.008;s:43:"VuFindTest\ILS\Driver\PAIATest::testProfile";d:0.004;s:48:"VuFindTest\ILS\Driver\PAIATest::testValidRequest";d:0.003;s:48:"VuFindTest\ILS\Driver\PAIATest::testRenewDetails";d:0.001;s:45:"VuFindTest\ILS\Driver\PAIATest::testPlaceHold";d:0.004;s:64:"VuFindTest\ILS\Driver\PAIATest::testPlaceStorageRetrievalRequest";d:0.004;s:41:"VuFindTest\ILS\Driver\PAIATest::testRenew";d:0.006;s:56:"VuFindTest\ILS\Driver\PAIATest::testMissingConfiguration";d:0.001;s:66:"VuFindTest\ILS\Driver\PAIAFincTest::testMapOptionsPickupBranchTrue";d:0;s:57:"VuFindTest\ILS\Driver\PAIAFincTest::testMapOptionsNewTrue";d:0;s:79:"VuFindTest\ILS\Driver\PAIAFincTest::testMapOptionsPickupBranchFalseNoConditions";d:0.001;s:81:"VuFindTest\ILS\Driver\PAIAFincTest::testMapOptionsPickupBranchTrueUnknownOptionId";d:0;s:83:"VuFindTest\ILS\Driver\PAIAFincTest::testGetMyHoldsWithoutOptionConfigurationDefined";d:0.004;s:76:"VuFindTest\ILS\Driver\PAIAFincTest::testGetMyHoldsWithoutPaiaResponseOptions";d:0.006;s:69:"VuFindTest\ILS\Driver\PAIAFincTest::testGetMyHoldsAllowUnknownOptions";d:0.004;s:63:"VuFindTest\ILS\Driver\PAIAFincTest::testGetMyHoldsWrongInstance";d:0.004;s:66:"VuFindTest\ILS\Driver\PAIAFincTest::testGetMyHoldsWithPickUpBranch";d:0.006;s:73:"VuFindTest\ILS\Driver\PAIAFincTest::testGetMyHoldsWithAnotherPickUpBranch";d:0.004;s:81:"VuFindTest\ILS\Driver\PAIAFincTest::testGetMyHoldsWithMultipleOptionsPickUpBranch";d:0.004;s:63:"VuFindTest\ILS\Driver\PAIAFincTest::testgetOptionsReturnsIDTrue";d:0.002;s:68:"VuFindTest\ILS\Driver\PAIAFincTest::testgetOptionsNotOnlyFirstButAll";d:0.002;s:66:"VuFindTest\ILS\Driver\PAIAFincTest::testgetOptionsReturnsLabelTrue";d:0.004;s:67:"VuFindTest\ILS\Driver\PAIAFincTest::testgetOptionsReturnsEmptyArray";d:0.003;s:58:"VuFindTest\ILS\Driver\PAIAFincTest::testCallMapOptionsTrue";d:0.005;s:59:"VuFindTest\ILS\Driver\PAIAFincTest::testCallMapOptionsFalse";d:0.007;s:54:"VuFindTest\ILS\Driver\PAIAFincTest::testChangePassword";d:0.004;s:44:"VuFindTest\ILS\Driver\PAIAFincTest::testFees";d:0.004;s:45:"VuFindTest\ILS\Driver\PAIAFincTest::testHolds";d:0.006;s:48:"VuFindTest\ILS\Driver\PAIAFincTest::testRequests";d:0.004;s:52:"VuFindTest\ILS\Driver\PAIAFincTest::testTransactions";d:0.008;s:47:"VuFindTest\ILS\Driver\PAIAFincTest::testProfile";d:0.005;s:52:"VuFindTest\ILS\Driver\PAIAFincTest::testValidRequest";d:0.003;s:52:"VuFindTest\ILS\Driver\PAIAFincTest::testRenewDetails";d:0.001;s:49:"VuFindTest\ILS\Driver\PAIAFincTest::testPlaceHold";d:0.004;s:68:"VuFindTest\ILS\Driver\PAIAFincTest::testPlaceStorageRetrievalRequest";d:0.009;s:45:"VuFindTest\ILS\Driver\PAIAFincTest::testRenew";d:0.004;s:60:"VuFindTest\ILS\Driver\PAIAFincTest::testMissingConfiguration";d:0;s:64:"fincTest\RecordDriver\SolrMarcNewerPreviousTest::testNewerTitles";d:0.015;s:67:"fincTest\RecordDriver\SolrMarcNewerPreviousTest::testPreviousTitles";d:0.011;s:64:"fincTest\RecordDriver\SolrMarcNewerPreviousTest::testGetUniqueId";d:0;s:65:"FincTest\View\Helper\Root\ExternalCatalogueLinkTest::testGetLinks";d:0.004;s:66:"FincTest\View\Helper\Root\OpenUrlTest::testAddCustomParamsNoParams";d:0.03;s:70:"FincTest\View\Helper\Root\OpenUrlTest::testAddCustomStaticParamsForEzb";d:0.005;s:75:"FincTest\View\Helper\Root\OpenUrlTest::testDONTOverrideExistingParamsForEzb";d:0.005;s:71:"FincTest\View\Helper\Root\OpenUrlTest::testAddCustomStaticParamsForRedi";d:0.005;s:76:"FincTest\View\Helper\Root\OpenUrlTest::testDONTOverrideExistingParamsForRedi";d:0.005;s:71:"FincTest\View\Helper\Root\OpenUrlTest::testAddCustomDynamicParamsForEzb";d:0.005;s:72:"FincTest\View\Helper\Root\OpenUrlTest::testAddCustomDynamicParamsForRedi";d:0.005;s:65:"FincTest\View\Helper\Root\OpenUrlTest::testValidateParamsEzbFalse";d:0.005;s:64:"FincTest\View\Helper\Root\OpenUrlTest::testValidateParamsEzbTrue";d:0.027;s:63:"FincTest\View\Helper\Root\OpenUrlTest::testIsActiveIsIdempotent";d:0.008;s:63:"FincTest\View\Helper\Root\OpenUrlTest::testCheckContextDefaults";d:0.028;s:68:"FincTest\View\Helper\Root\OpenUrlTest::testCheckContextWithOverrides";d:0.005;s:60:"FincTest\View\Helper\Root\OpenUrlTest::testCheckContextNoUrl";d:0.005;s:73:"FincTest\View\Helper\Root\OpenUrlTest::testCheckExcludedRecordsRulesFalse";d:0.003;s:72:"FincTest\View\Helper\Root\OpenUrlTest::testCheckExcludedRecordsRulesTrue";d:0.003;s:93:"FincTest\View\Helper\Root\OpenUrlTest::testCheckExcludedRecordsRulesFalseDueToWildcardFailure";d:0.031;s:74:"FincTest\View\Helper\Root\OpenUrlTest::testCheckSupportedRecordsRulesFalse";d:0.003;s:91:"FincTest\View\Helper\Root\OpenUrlTest::testCheckSupportedRecordsRulesWithWildcardStillFalse";d:0.003;s:73:"FincTest\View\Helper\Root\OpenUrlTest::testCheckSupportedRecordsRulesTrue";d:0.003;s:67:"FincTest\View\Helper\Root\OpenUrlTest::testRecordDriverClassInRules";d:0.005;}}}
\ No newline at end of file
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://www.swissbib.org * @link http://www.swissbib.org
*/ */
use Zend\Mvc\Service\ServiceManagerConfig; use Laminas\Mvc\Service\ServiceManagerConfig;
use Zend\ServiceManager\ServiceManager; use Laminas\ServiceManager\ServiceManager;
use Zend\Stdlib\ArrayUtils; use Laminas\Stdlib\ArrayUtils;
/** /**
* Bootstrap * Bootstrap
......
...@@ -29,8 +29,8 @@ namespace VuFindTest\ILS\Driver; ...@@ -29,8 +29,8 @@ namespace VuFindTest\ILS\Driver;
use finc\ILS\Driver\PAIA as fincPAIA; use finc\ILS\Driver\PAIA as fincPAIA;
use InvalidArgumentException; use InvalidArgumentException;
use Zend\Http\Client\Adapter\Test as TestAdapter; use Laminas\Http\Client\Adapter\Test as TestAdapter;
use Zend\Http\Response as HttpResponse; use Laminas\Http\Response as HttpResponse;
/** /**
* ILS driver test * ILS driver test
...@@ -622,7 +622,7 @@ class PAIAFincTest extends \VuFindTest\ILS\Driver\PAIATest ...@@ -622,7 +622,7 @@ class PAIAFincTest extends \VuFindTest\ILS\Driver\PAIATest
$paia = $this->getMockBuilder(PAIAMock::class) $paia = $this->getMockBuilder(PAIAMock::class)
->enableProxyingToOriginalMethods() ->enableProxyingToOriginalMethods()
->setMethods(['mapOptions']) ->setMethods(['mapOptions'])
->setConstructorArgs([new \VuFind\Date\Converter(), new \Zend\Session\SessionManager()]) ->setConstructorArgs([new \VuFind\Date\Converter(), new \Laminas\Session\SessionManager()])
->getMock(); ->getMock();
$paia->prepare("fincWithOnePickupBranchOption.json"); $paia->prepare("fincWithOnePickupBranchOption.json");
...@@ -644,7 +644,7 @@ class PAIAFincTest extends \VuFindTest\ILS\Driver\PAIATest ...@@ -644,7 +644,7 @@ class PAIAFincTest extends \VuFindTest\ILS\Driver\PAIATest
$paia = $this->getMockBuilder(PAIAMock::class) $paia = $this->getMockBuilder(PAIAMock::class)
->enableProxyingToOriginalMethods() ->enableProxyingToOriginalMethods()
->setMethods(['mapOptions']) ->setMethods(['mapOptions'])
->setConstructorArgs([new \VuFind\Date\Converter(), new \Zend\Session\SessionManager()]) ->setConstructorArgs([new \VuFind\Date\Converter(), new \Laminas\Session\SessionManager()])
->getMock(); ->getMock();
$paia->prepare("fincWithOnePickupBranchOption.json"); $paia->prepare("fincWithOnePickupBranchOption.json");
...@@ -692,7 +692,7 @@ class PAIAFincTest extends \VuFindTest\ILS\Driver\PAIATest ...@@ -692,7 +692,7 @@ class PAIAFincTest extends \VuFindTest\ILS\Driver\PAIATest
$service->setDefaultAdapter($adapter); $service->setDefaultAdapter($adapter);
$conn = new PAIAMock( $conn = new PAIAMock(
new \VuFind\Date\Converter(), new \VuFind\Date\Converter(),
new \Zend\Session\SessionManager() new \Laminas\Session\SessionManager()
); );
$conn->setHttpService($service); $conn->setHttpService($service);
return $conn; return $conn;
...@@ -711,7 +711,7 @@ class PAIAFincTest extends \VuFindTest\ILS\Driver\PAIATest ...@@ -711,7 +711,7 @@ class PAIAFincTest extends \VuFindTest\ILS\Driver\PAIATest
$paia = new fincPAIA( $paia = new fincPAIA(
new \VuFind\Date\Converter(), new \VuFind\Date\Converter(),
new \Zend\Session\SessionManager() new \Laminas\Session\SessionManager()
); );
return [$method, $paia]; return [$method, $paia];
......
...@@ -77,7 +77,7 @@ class SolrBaseTestCase extends VuFindTestCase ...@@ -77,7 +77,7 @@ class SolrBaseTestCase extends VuFindTestCase
return $decode ? json_decode($content, true) : $content; return $decode ? json_decode($content, true) : $content;
} }
protected function setUp() protected function setUp(): void
{ {
parent::setUp(); parent::setUp();
$this->driver = $this->getDriverMock(); $this->driver = $this->getDriverMock();
...@@ -89,11 +89,11 @@ class SolrBaseTestCase extends VuFindTestCase ...@@ -89,11 +89,11 @@ class SolrBaseTestCase extends VuFindTestCase
* @param array $plugins Custom VuFind plug-ins to register * @param array $plugins Custom VuFind plug-ins to register
* @param string $theme Theme directory to load from * @param string $theme Theme directory to load from
* *
* @return \Zend\View\Renderer\PhpRenderer * @return \Laminas\View\Renderer\PhpRenderer
*/ */
protected function getPhpRenderer($plugins = [], $theme = 'finc') protected function getPhpRenderer($plugins = [], $theme = 'finc')
{ {
$resolver = new \Zend\View\Resolver\TemplatePathStack(); $resolver = new \Laminas\View\Resolver\TemplatePathStack();
// This assumes that all themes will be testing inherit directly // This assumes that all themes will be testing inherit directly
// from root with no intermediate themes. Probably safe for most // from root with no intermediate themes. Probably safe for most
...@@ -103,7 +103,7 @@ class SolrBaseTestCase extends VuFindTestCase ...@@ -103,7 +103,7 @@ class SolrBaseTestCase extends VuFindTestCase
APPLICATION_PATH . '/themes/' . $theme . '/templates' APPLICATION_PATH . '/themes/' . $theme . '/templates'
] ]
); );
$renderer = new \Zend\View\Renderer\PhpRenderer(); $renderer = new \Laminas\View\Renderer\PhpRenderer();
$renderer->setResolver($resolver); $renderer->setResolver($resolver);
if (!empty($plugins)) { if (!empty($plugins)) {
$pluginManager = $renderer->getHelperPluginManager(); $pluginManager = $renderer->getHelperPluginManager();
...@@ -125,7 +125,7 @@ class SolrBaseTestCase extends VuFindTestCase ...@@ -125,7 +125,7 @@ class SolrBaseTestCase extends VuFindTestCase
protected function getPlugins($id) protected function getPlugins($id)
{ {
$record = new RecordViewHelperMock($this->driver); $record = new RecordViewHelperMock($this->driver);
$serverUrl = $this->createMock(\Zend\View\Helper\ServerUrl::class); $serverUrl = $this->createMock(\Laminas\View\Helper\ServerUrl::class);
/*TODO: should be called only once*/ /*TODO: should be called only once*/
$serverUrl->expects(/*$this->once()*/$this->any())->method('__invoke') $serverUrl->expects(/*$this->once()*/$this->any())->method('__invoke')
->will($this->returnValue('http://localhost:11100/')); ->will($this->returnValue('http://localhost:11100/'));
......
...@@ -28,7 +28,7 @@ namespace fincTest\RecordDriver; ...@@ -28,7 +28,7 @@ namespace fincTest\RecordDriver;
use finc\RecordDriver\SolrMarcFinc as SolrMarcFincDriver; use finc\RecordDriver\SolrMarcFinc as SolrMarcFincDriver;
use finc\RecordDriver\SolrMarcFincTrait; use finc\RecordDriver\SolrMarcFincTrait;
use Zend\Session\Container; use Laminas\Session\Container;
/** /**
* SolrMarcNewerPreviousTest * SolrMarcNewerPreviousTest
...@@ -46,7 +46,7 @@ class SolrMarcNewerPreviousTest extends SolrBaseTestCase ...@@ -46,7 +46,7 @@ class SolrMarcNewerPreviousTest extends SolrBaseTestCase
* *
* @return void * @return void
*/ */
public function setUp() public function setUp(): void
{ {
$this->initialize('misc/0002795235.json'); $this->initialize('misc/0002795235.json');
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
namespace FincTest\View\Helper\Root; namespace FincTest\View\Helper\Root;
use finc\View\Helper\Root\ExternalCatalogueLink; use finc\View\Helper\Root\ExternalCatalogueLink;
use Zend\Config\Config; use Laminas\Config\Config;
/** /**
* External Catalogue Link Test Class * External Catalogue Link Test Class
......
...@@ -20,13 +20,13 @@ ...@@ -20,13 +20,13 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2 * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
*/ */
use \Laminas\Form\Element; use Laminas\Form\Element;
use \Laminas\Form\Element\Submit; use Laminas\Form\Element\Submit;
use \Laminas\Form\Form; use Laminas\Form\Form;
use \Laminas\Form\View\Helper\FormElementErrors; use Laminas\Form\View\Helper\FormElementErrors;
use \Laminas\Form\View\Helper\FormLabel; use Laminas\Form\View\Helper\FormLabel;
use \Laminas\Form\View\Helper\FormSelect; use Laminas\Form\View\Helper\FormSelect;
use \Laminas\Form\View\Helper\FormSubmit; use Laminas\Form\View\Helper\FormSubmit;
/** @var Form $form */ /** @var Form $form */
/** @var FormLabel $formLabel */ /** @var FormLabel $formLabel */
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment