Skip to content

Commit

Permalink
Merge branch 'dev' into improve-screenshot-test-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
demiankatz committed Jan 31, 2024
2 parents ce47aa5 + 2a1c90e commit 7bded24
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 22 deletions.
4 changes: 1 addition & 3 deletions module/VuFind/src/VuFind/Recommend/Databases.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@

namespace VuFind\Recommend;

use Laminas\Cache\Storage\Adapter\AbstractAdapter as CacheAdapter;
use Laminas\Config\Config;
use VuFind\Connection\LibGuides;
use Laminas\Cache\Storage\StorageInterface as CacheAdapter;

use function count;
use function intval;
Expand Down
2 changes: 1 addition & 1 deletion module/VuFind/src/VuFind/Recommend/LibGuidesProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

namespace VuFind\Recommend;

use Laminas\Cache\Storage\Adapter\AbstractAdapter as CacheAdapter;
use Laminas\Cache\Storage\StorageInterface as CacheAdapter;
use Laminas\Config\Config;
use VuFind\Connection\LibGuides;

Expand Down
2 changes: 1 addition & 1 deletion module/VuFind/src/VuFind/View/Helper/Root/ProxyUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
namespace VuFind\View\Helper\Root;

use Exception;
use Laminas\Cache\Storage\Adapter\AbstractAdapter as CacheAdapter;
use Laminas\Cache\Storage\StorageInterface as CacheAdapter;

use function intval;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

namespace VuFindTest\Config;

use Laminas\Cache\Storage\Adapter\AbstractAdapter;
use Laminas\Cache\Storage\StorageInterface;
use VuFind\Config\YamlReader;
use VuFindTest\Feature\FixtureTrait;
use VuFindTest\Feature\PathResolverTrait;
Expand Down Expand Up @@ -59,8 +59,7 @@ class YamlReaderTest extends \PHPUnit\Framework\TestCase
public function testCacheWrite()
{
$yamlData = ['foo' => 'bar'];
$cache = $this->getMockBuilder(AbstractAdapter::class)
->getMock();
$cache = $this->createMock(StorageInterface::class);
$cache->expects($this->once())->method('getItem')
->will($this->returnValue(null));
$cache->expects($this->once())->method('setItem')
Expand Down Expand Up @@ -92,8 +91,7 @@ public function testCacheWrite()
public function testCacheRead()
{
$yamlData = ['foo' => 'bar'];
$cache = $this->getMockBuilder(AbstractAdapter::class)
->getMock();
$cache = $this->createMock(StorageInterface::class);
$cache->expects($this->once())->method('getItem')
->will($this->returnValue($yamlData));
$cache->expects($this->never())->method('setItem');
Expand Down Expand Up @@ -122,8 +120,7 @@ public function testCacheRead()
public function testCacheForcedReload()
{
$yamlData = ['foo' => 'bar'];
$cache = $this->getMockBuilder(AbstractAdapter::class)
->getMock();
$cache = $this->createMock(StorageInterface::class);
$cache->expects($this->exactly(2))->method('getItem')
->will($this->returnValue($yamlData));
$cache->expects($this->never())->method('setItem');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

namespace VuFindTest\Recommend;

use Laminas\Cache\Storage\Adapter\AbstractAdapter as CacheAdapter;
use Laminas\Cache\Storage\StorageInterface as CacheAdapter;
use VuFind\Recommend\Databases;

/**
Expand Down Expand Up @@ -162,7 +162,7 @@ protected function buildModuleAndProcessResults($configData, $queryString = 'His
return $libGuides;
};

$cache = $this->getMockBuilder(CacheAdapter::class)->getMock();
$cache = $this->createMock(CacheAdapter::class);
$module = $this->getMockBuilder(Databases::class)
->setConstructorArgs([$configManager, $libGuidesGetter, $cache])
->onlyMethods(['getCachedData', 'putCachedData'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

namespace VuFindTest\Recommend;

use Laminas\Cache\Storage\Adapter\AbstractAdapter as CacheAdapter;
use Laminas\Cache\Storage\StorageInterface as CacheAdapter;
use Laminas\Config\Config;
use VuFind\Config\PluginManager as ConfigPluginManager;
use VuFind\Connection\LibGuides;
Expand Down Expand Up @@ -200,7 +200,7 @@ protected function buildProfile($config)
{
// Mock caching logic in LibGuidesProfile.
// Caching is from a trait, which is not the point of this test suite.
$this->cacheAdapter = $this->getMockBuilder(CacheAdapter::class)->getMock();
$this->cacheAdapter = $this->createMock(CacheAdapter::class);

// For the target class LibGuidesProfile, only mock the caching methods
$libGuidesProfile = $this->getMockBuilder(LibGuidesProfile::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
namespace VuFindSearch\Backend\EDS;

use Exception;
use Laminas\Cache\Storage\Adapter\AbstractAdapter as CacheAdapter;
use Laminas\Cache\Storage\StorageInterface as CacheAdapter;
use Laminas\Config\Config;
use Laminas\Session\Container as SessionContainer;
use VuFindSearch\Backend\AbstractBackend;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1245,9 +1245,7 @@ protected function getEDSBackendMock($fixture = null)
->method('call')
->will($this->returnCallback($callback));

$cache = $this->getMockForAbstractClass(
\Laminas\Cache\Storage\Adapter\AbstractAdapter::class
);
$cache = $this->createMock(\Laminas\Cache\Storage\StorageInterface::class);
$container = $this->getMockBuilder(\Laminas\Session\Container::class)
->disableOriginalConstructor()->getMock();
$params = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ protected function getConnectorMock(array $mock = [])
*
* @param \VuFindSearch\Backend\EDS\Connector $connector Connector
* @param \VuFindSearch\Response\RecordCollectionFactoryInterface $factory Record collection factory
* @param \Laminas\Cache\Storage\Adapter\AbstractAdapter $cache Object cache adapter
* @param \Laminas\Cache\Storage\StorageInterface $cache Object cache adapter
* @param \Laminas\Session\Container $container Session container
* @param array $settings Additional settings
* @param array $mock Methods to mock (or null for a
Expand All @@ -323,7 +323,7 @@ protected function getBackend(
$factory = $this->createMock(\VuFindSearch\Response\RecordCollectionFactoryInterface::class);
}
if (null === $cache) {
$cache = $this->getMockForAbstractClass(\Laminas\Cache\Storage\Adapter\AbstractAdapter::class);
$cache = $this->createMock(\Laminas\Cache\Storage\StorageInterface::class);
}
if (null === $container) {
$container = $this->getMockBuilder(\Laminas\Session\Container::class)
Expand Down

0 comments on commit 7bded24

Please sign in to comment.