mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Bug fixes from tests
This commit is contained in:
parent
39635c1115
commit
dbe837a52e
|
|
@ -22,7 +22,7 @@ use phpOMS\Message\Http\Request;
|
|||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\System\File\PathException;
|
||||
use phpOMS\Module\Exception\InvalidModuleException;
|
||||
use phpOMs\DataStorage\Database\Query\Builder;
|
||||
use phpOMS\DataStorage\Database\Query\Builder;
|
||||
|
||||
/**
|
||||
* Modules class.
|
||||
|
|
@ -143,7 +143,6 @@ final class ModuleManager
|
|||
{
|
||||
if ($this->uriLoad === null) {
|
||||
$uriHash = $request->getHash();
|
||||
$uriPdo = '';
|
||||
|
||||
$query = new Builder($this->app->dbPool->get('select'));
|
||||
$query->prefix($this->app->dbPool->get('select')->prefix);
|
||||
|
|
@ -183,12 +182,12 @@ final class ModuleManager
|
|||
|
||||
foreach ($active as $module) {
|
||||
$path = $this->modulePath . '/' . $module . '/info.json';
|
||||
|
||||
|
||||
if (!\file_exists($path)) {
|
||||
continue;
|
||||
// throw new PathException($path);
|
||||
}
|
||||
|
||||
|
||||
$content = \file_get_contents($path);
|
||||
$json = \json_decode($content === false ? '[]' : $content, true);
|
||||
$this->active[$json['name']['internal']] = $json === false ? [] : $json;
|
||||
|
|
@ -278,12 +277,12 @@ final class ModuleManager
|
|||
|
||||
foreach ($installed as $module) {
|
||||
$path = $this->modulePath . '/' . $module . '/info.json';
|
||||
|
||||
|
||||
if (!\file_exists($path)) {
|
||||
continue;
|
||||
// throw new PathException($path);
|
||||
}
|
||||
|
||||
|
||||
$content = \file_get_contents($path);
|
||||
$json = \json_decode($content === false ? '[]' : $content, true);
|
||||
$this->installed[$json['name']['internal']] = $json === false ? [] : $json;
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class Currency
|
|||
public static function getEcbEuroRates() : array
|
||||
{
|
||||
if (!isset(self::$ecbCurrencies)) {
|
||||
$request = new Request(new Http('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml'));
|
||||
$request = new Request(new Http('https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml'));
|
||||
$request->setMethod(RequestMethod::GET);
|
||||
|
||||
$xml = new \SimpleXMLElement(Rest::request($request));
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ final class StringCompare
|
|||
}
|
||||
|
||||
foreach ($words1 as $word1) {
|
||||
// todo: is this correct?
|
||||
$best = \strlen($s2);
|
||||
|
||||
foreach ($words2 as $word2) {
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@ class ErrorTest extends \PHPUnit\Framework\TestCase
|
|||
public function testScaledError()
|
||||
{
|
||||
self::assertEquals(
|
||||
[Error::getScaledError(Error::getForecastError(1000, 700), 1000)],
|
||||
Error::getScaledErrorArray([Error::getForecastError(1000, 700)], [1000])
|
||||
[Error::getScaledError(Error::getForecastError(1000, 700), [1000, 800])],
|
||||
Error::getScaledErrorArray([Error::getForecastError(1000, 700)], [1000, 800])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,9 +51,14 @@ class CommitTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals([
|
||||
'/some/file/path2' => []
|
||||
], $commit->getFiles());
|
||||
}
|
||||
|
||||
public function testChanges()
|
||||
{
|
||||
$commit = new Commit();
|
||||
|
||||
$commit->addChanges(__DIR__ . '/CommitTest.php', 1, '<?php', 'test');
|
||||
self::assertTrue(
|
||||
self::assertEquals(
|
||||
[
|
||||
__DIR__ . '/CommitTest.php' => [
|
||||
1 => [
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user