Skip to content

Commit

Permalink
Merge pull request #1026 from oat-sa/release-15.22
Browse files Browse the repository at this point in the history
Release 15.22
  • Loading branch information
gabrielfs7 authored Sep 27, 2022
2 parents 7bebeea + c3ce5f8 commit 34c1df1
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 35 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
fail-fast: false
matrix:
operating-system: [ ubuntu-latest ]
php-version: [ '7.2', '7.3', '7.4', '8.0', '8.1' ]
php-version: [ '7.4', '8.0', '8.1' ]
include:
- php-version: '7.2'
- php-version: '8.1'
coverage: true

steps:
Expand Down
12 changes: 6 additions & 6 deletions common/cache/class.SingletonCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ public static function singleton()
{
$returnValue = null;


$cacheName = get_called_class();
if (!isset(self::$instances[$cacheName])) {
self::$instances[$cacheName] = new $cacheName();
}

$returnValue = self::$instances[$cacheName];


return $returnValue;
}
Expand All @@ -78,7 +78,7 @@ public static function getCached($function)
{
$returnValue = null;


$args = func_get_args();
array_shift($args);
if (!is_string($function)) {
Expand All @@ -94,10 +94,10 @@ public static function getCached($function)
if (static::singleton()->has($serial)) {
$returnValue = static::singleton()->has($serial);
} else {
$returnValue = call_user_func_array($fn, $args);
$returnValue = call_user_func_array($function, $args);
static::singleton()->put($serial, $returnValue);
}


return $returnValue;
}
Expand Down
2 changes: 1 addition & 1 deletion common/oatbox/log/VerboseLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class VerboseLogger extends AbstractLogger
*/
public function __construct($minimumLevel)
{
if (! in_array($minimumLevel, array_keys($this->levels))) {
if (!in_array($minimumLevel, $this->levels, true)) {
throw new \common_Exception('Level "' . $minimumLevel . '" is not managed by verbose logger');
}
$this->levelPosition = array_search($minimumLevel, $this->levels);
Expand Down
22 changes: 14 additions & 8 deletions common/persistence/class.PhpFileDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ class common_persistence_PhpFileDriver implements common_persistence_KvDriver, c
* @var string
*/
private $directory;

/**
* Nr of subfolder levels in order to prevent filesystem bottlenecks
* Only used in non human readable mode
*
* @var int
*/
private $levels;

/**
* Whenever or not the filenames should be human readable
* FALSE by default for performance issues with many keys
Expand All @@ -81,7 +81,7 @@ class common_persistence_PhpFileDriver implements common_persistence_KvDriver, c
* @var int
*/
const DEFAULT_LEVELS = 3;

const DEFAULT_MASK = 0700;

/**
Expand All @@ -103,7 +103,7 @@ public function connect($id, array $params)

return new common_persistence_KeyValuePersistence($params, $this);
}

/**
* (non-PHPdoc)
* @see common_persistence_KvDriver::set()
Expand Down Expand Up @@ -239,7 +239,13 @@ public function get($id)
*/
private function readFile($id)
{
return @include $this->getPath($id);
$path = $this->getPath($id);

if (is_readable($path)) {
return @include $path;
}

return false;
}

/**
Expand All @@ -264,7 +270,7 @@ public function exists($id)
return $this->get($id) !== false;
}
}

/**
* (non-PHPdoc)
* @see common_persistence_KvDriver::del()
Expand Down Expand Up @@ -386,7 +392,7 @@ protected function getPath($key)
}
return $this->directory . $path . '.php';
}

/**
* Cannot use helpers_File::sanitizeInjectively() because
* of backwards compatibility
Expand All @@ -402,7 +408,7 @@ protected function sanitizeReadableFileName($key)
}
return $path;
}

/**
* Generate the php code that returns the provided value
*
Expand Down
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@
"tao-extension-name": "generis"
},
"require": {
"php": "^7.1",
"clearfw/clearfw": "~1.2.0",
"easyrdf/easyrdf": "^1.1",
"doctrine/dbal": "^2.10.1",
"doctrine/annotations": "^1.6.0",
"doctrine/dbal": "^2.12",
"doctrine/annotations": "^1.13",
"laminas/laminas-servicemanager": "~2.5.0",
"league/flysystem": "~1.0",
"league/flysystem-memory": "~1.0",
Expand All @@ -80,7 +79,7 @@
"ext-pdo": "*"
},
"require-dev": {
"mikey179/vfsstream": "1.4.0",
"mikey179/vfsstream": "~1",
"phpunit/phpunit": "^8.5",
"php-mock/php-mock": "^2.0"
},
Expand Down
7 changes: 2 additions & 5 deletions test/integration/mutex/test_action.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@
$sleep = (int) $argv[1];
$timeout = (int) $argv[2];

$service = getInstance();
$service = getLockServiceInstance();
$factory = $service->getLockFactory();
$lock = $factory->createLock($actionId, $timeout);
$lock->acquire(true);
sleep($sleep);
$lock->release();

/**
* @return LockService
*/
function getInstance()
function getLockServiceInstance(): LockService
{
return ServiceManager::getServiceManager()->get(LockService::class);
}
8 changes: 4 additions & 4 deletions test/unit/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function testPHPRuntime()
$this->assertTrue($php->isOptional());

// max & min test.
$php = new \common_configuration_PHPRuntime('5.3', '7.4.x');
$php = new \common_configuration_PHPRuntime('7.4', '8.1.x');
$report = $php->check();

$this->assertEquals($report->getStatus(), \common_configuration_Report::VALID);
Expand Down Expand Up @@ -169,7 +169,7 @@ function testPHPExtension()
$report = $ext->check();
$this->assertEquals($report->getStatus(), \common_configuration_Report::VALID);

$ext->setMax('7.5');
$ext->setMax('8.2');
$report = $ext->check();
$this->assertEquals($report->getStatus(), \common_configuration_Report::VALID);

Expand Down Expand Up @@ -310,7 +310,7 @@ public function testSimpleComponentCollection()

public function testComponentFactory()
{
$component = \common_configuration_ComponentFactory::buildPHPRuntime('5.0', '7.4.x', true);
$component = \common_configuration_ComponentFactory::buildPHPRuntime('5.0', '8.1.x', true);
$this->assertInstanceOf(\common_configuration_PHPRuntime::class, $component);
$this->assertEquals($component->getMin(), '5.0');
// 5.5.x will be replaced internally
Expand Down Expand Up @@ -353,7 +353,7 @@ public function testComponentFactory()
$this->assertInstanceOf(\common_configuration_Report::class, $report);
$this->assertEquals($report->getStatus(), \common_configuration_Report::VALID);

$array = ['type' => 'PHPRuntime', 'value' => ['min' => '5.0', 'max' => '7.4.x', 'optional' => true]];
$array = ['type' => 'PHPRuntime', 'value' => ['min' => '5.0', 'max' => '8.1.x', 'optional' => true]];
$component = \common_configuration_ComponentFactory::buildFromArray($array);
$this->assertInstanceOf(\common_configuration_PHPRuntime::class, $component);
$this->assertEquals($component->getMin(), '5.0');
Expand Down
4 changes: 2 additions & 2 deletions test/unit/common/configuration/ComponentFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ public function testBuildFileSystemComponent()
$this->assertTrue($output->isOptional());
$this->assertTrue($output->getRecursive());
$this->assertTrue($output->getMustCheckIfEmpty());
$this->assertEquals('FileSystemComponentCheck_3', $output->getName());
$this->assertStringStartsWith('FileSystemComponentCheck_', $output->getName());

$output2 = $this->subject->buildFileSystemComponent('/path2', 'rw');

$this->assertEquals('FileSystemComponentCheck_4', $output2->getName());
$this->assertStringStartsWith('FileSystemComponentCheck_', $output2->getName());
}

public function testBuildCustomFailureOnNonExistingExtension()
Expand Down
4 changes: 2 additions & 2 deletions test/unit/core/Middleware/MiddlewareRequestHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function testAssertRoute(string $path, string $httpMethod, array $middlew
$queue = array_merge(
array_values($middlewaresMocks),
[
static function ($request, $next): ResponseInterface {
function ($request, $next): ResponseInterface {
return $this->originalResponse;
}
]
Expand Down Expand Up @@ -175,7 +175,7 @@ public function testAssertNoRoute(string $path, string $httpMethod): void
{
$queue = array_merge(
[
static function ($request, $next): ResponseInterface {
function ($request, $next): ResponseInterface {
return $this->originalResponse;
}
]
Expand Down
2 changes: 1 addition & 1 deletion test/unit/oatbox/mutex/test_action.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use oat\oatbox\mutex\NoLockStorage;

// phpcs:disable
require __DIR__ . '/../../../../../vendor/autoload.php';
require __DIR__ . '/../../../bootstrap.php';

function getInstance($class, $dir): LockService
{
Expand Down

0 comments on commit 34c1df1

Please sign in to comment.