Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F24928960
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
22 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/_utils/templates/generate-compose-json.php b/_utils/templates/generate-compose-json.php
index 737e73c..3b8172b 100755
--- a/_utils/templates/generate-compose-json.php
+++ b/_utils/templates/generate-compose-json.php
@@ -1,175 +1,175 @@
#!/usr/bin/env php
<?php
# -------------------------------------------------------------
# Generate composer.json from packages metadata
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Keruald
# License: BSD-2-Clause
# Dependencies: symfony/yaml, keruald/omnitools
# -------------------------------------------------------------
use Keruald\OmniTools\Collections\Vector;
use Keruald\OmniTools\Collections\HashMap;
use Symfony\Component\Yaml\Parser as YamlParser;
require_once __DIR__ . "/../../vendor/autoload.php";
# -------------------------------------------------------------
# Helper methods to build elements from metadata
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function getAutoload(array $packages_namespaces) : array {
return [
"psr-4" => HashMap::from($packages_namespaces)
->flatMap(fn($package, $ns) => [
$ns . '\\' => $package . "/src/",
$ns . '\\Tests\\' => $package . "/tests/",
])
->toArray()
];
}
function getReplace(array $packages) : array {
return HashMap::from($packages)
->mapValuesAndKeys(
fn($v) => ["keruald/$v", getPackageVersion($v)]
)
->toArray();
}
function getPackageVersion (string $package) : string {
$tags = PackagesTags::load();
return $tags->packages[$package] ?? "self.version";
}
class PackagesTags {
///
/// Singleton pattern
///
private static ?self $instance = null;
public static function load () : self {
if (self::$instance === null) {
self::$instance = new self();
}
return self::$instance;
}
///
/// Properties
///
public HashMap $packages;
///
/// Constructor
///
public function __construct () {
$this->packages = self::getPackagesLastTags();
}
///
/// Read metadata from Git repository
///
private static function getPackagesLastTags () : HashMap {
$map = new HashMap;
$tags = self::getRepositoryTags();
foreach ($tags as $tag) {
[$package, $version] = explode("/", $tag);
if (!$map->has($package)) {
$map->set($package, $version);
continue;
}
if (version_compare($map[$package], $version) == -1) {
$map->set($package, $version);
}
}
return $map;
}
private static function getRepositoryTags () : Vector {
exec("git tag", $tags);
return Vector::from($tags)
->filter(fn($tag) => str_contains($tag, "/"));
}
}
# -------------------------------------------------------------
# Template
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function run() : never {
$metadata = (new YamlParser())->parseFile("metadata.yml");
$flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
echo json_encode(getTemplate($metadata), $flags), "\n";
exit(0);
}
function getTemplate(array $metadata) : array {
return [
"name" => "keruald/keruald",
"type" => "library",
"description" => "Modular libraries to build frameworks and applications",
"keywords" => [
"framework",
"keruald",
],
"license" => "BSD-2-Clause",
"homepage" => "https://keruald.nasqueron.org",
"authors" => [
[
"name" => "Sébastien Santoro",
"email" => "dereckson@espace-win.org",
],
[
"name" => "Keruald contributors",
],
],
"provide" => [
"psr/simple-cache-implementation" => "1.0|2.0|3.0",
],
"require" => [
"psr/simple-cache" => "^1.0|^2.0|^3.0",
"ext-intl" => "*",
],
"require-dev" => [
"ext-mbstring" => "*",
"ext-mysqli" => "*",
"ext-xmlwriter" => "*",
"nasqueron/codestyle" => "^0.1.2",
"phan/phan" => "^5.3.1",
- "phpunit/phpunit" => "^10.2",
+ "phpunit/phpunit" => "^12.4",
"symfony/yaml" => "^6.0.3",
"squizlabs/php_codesniffer" => "^4.0.0",
],
"suggest" => [
"ext-memcached" => "*",
"ext-redis" => "*",
],
"replace" => getReplace($metadata["packages"]),
"autoload" => getAutoload($metadata["packages_namespaces"]),
"scripts" => [
"lint-src" => "find */src -type f -name '*.php' | xargs -n1 php -l",
"lint-tests" => "find */tests -type f -name '*.php' | xargs -n1 php -l",
"test" => "vendor/bin/phpunit",
],
"minimum-stability" => "dev",
];
}
run();
diff --git a/cache/composer.json b/cache/composer.json
index 1f51656..0be0139 100644
--- a/cache/composer.json
+++ b/cache/composer.json
@@ -1,29 +1,29 @@
{
"name": "keruald/cache",
"description": "Abstraction layer for cache. Compatible PSR-16.",
"keywords": [
"keruald",
"cache"
],
"minimum-stability": "stable",
"license": "BSD-2-Clause",
"authors": [
{
"name": "Sébastien Santoro",
"email": "dereckson@espace-win.org"
}
],
"provide": {
"psr/simple-cache-implementation": "1.0|2.0|3.0"
},
"require": {
"keruald/omnitools": "^0.11"
},
"require-dev": {
- "phpunit/phpunit": "^10.2"
+ "phpunit/phpunit": "^12.4"
},
"suggest": {
"ext-memcached": "*",
"ext-redis": "*"
}
}
diff --git a/commands/composer.json b/commands/composer.json
index ec026ee..ec47217 100644
--- a/commands/composer.json
+++ b/commands/composer.json
@@ -1,25 +1,25 @@
{
"name": "keruald/commands",
"description": "Classes to build CLI commands",
"type": "library",
"license": "BSD-2-Clause",
"authors": [
{
"name": "Sébastien Santoro",
"email": "dereckson@espace-win.org"
}
],
"autoload": {
"psr-4": {
"Keruald\\Commands\\": "src/",
"Keruald\\Commands\\Tests\\": "tests/"
}
},
"require": {
},
"require-dev": {
"phan/phan": "^5.3",
- "phpunit/phpunit": "^10.2",
+ "phpunit/phpunit": "^12.4",
"squizlabs/php_codesniffer": "^3"
}
}
diff --git a/composer.json b/composer.json
index 4a61a86..38dc4c0 100644
--- a/composer.json
+++ b/composer.json
@@ -1,75 +1,75 @@
{
"name": "keruald/keruald",
"type": "library",
"description": "Modular libraries to build frameworks and applications",
"keywords": [
"framework",
"keruald"
],
"license": "BSD-2-Clause",
"homepage": "https://keruald.nasqueron.org",
"authors": [
{
"name": "Sébastien Santoro",
"email": "dereckson@espace-win.org"
},
{
"name": "Keruald contributors"
}
],
"provide": {
"psr/simple-cache-implementation": "1.0|2.0|3.0"
},
"require": {
"psr/simple-cache": "^1.0|^2.0|^3.0",
"symfony/yaml": "^7.3.5",
"ext-intl": "*"
},
"require-dev": {
"ext-mbstring": "*",
"ext-mysqli": "*",
"ext-pdo": "*",
"ext-xmlwriter": "*",
"nasqueron/codestyle": "^0.1.2",
"phan/phan": "^5.3.1",
- "phpunit/phpunit": "^10.2",
+ "phpunit/phpunit": "^12.4",
"squizlabs/php_codesniffer": "^4.0.0"
},
"suggest": {
"ext-memcached": "*",
"ext-redis": "*"
},
"replace": {
"keruald/cache": "0.1.1",
"keruald/commands": "0.0.1",
"keruald/database": "0.6.1",
"keruald/github": "0.2.1",
"keruald/omnitools": "0.16.0",
"keruald/report": "0.1.0",
"keruald/yaml": "0.1.1"
},
"autoload": {
"psr-4": {
"Keruald\\Cache\\": "cache/src/",
"Keruald\\Cache\\Tests\\": "cache/tests/",
"Keruald\\Commands\\": "commands/src/",
"Keruald\\Commands\\Tests\\": "commands/tests/",
"Keruald\\Database\\": "database/src/",
"Keruald\\Database\\Tests\\": "database/tests/",
"Keruald\\GitHub\\": "github/src/",
"Keruald\\GitHub\\Tests\\": "github/tests/",
"Keruald\\OmniTools\\": "omnitools/src/",
"Keruald\\OmniTools\\Tests\\": "omnitools/tests/",
"Keruald\\Reporting\\": "report/src/",
"Keruald\\Reporting\\Tests\\": "report/tests/",
"Keruald\\Yaml\\": "yaml/src/",
"Keruald\\Yaml\\Tests\\": "yaml/tests/"
}
},
"scripts": {
"lint-src": "find */src -type f -name '*.php' | xargs -n1 php -l",
"lint-tests": "find */tests -type f -name '*.php' | xargs -n1 php -l",
"test": "vendor/bin/phpunit"
},
"minimum-stability": "dev"
}
diff --git a/database/composer.json b/database/composer.json
index f46c89f..bedb44f 100644
--- a/database/composer.json
+++ b/database/composer.json
@@ -1,26 +1,26 @@
{
"name": "keruald/database",
"description": "Allow to query a database",
"type": "library",
"require-dev": {
"phan/phan": "^5.3.2",
"squizlabs/php_codesniffer": "^4.0.0",
- "phpunit/phpunit": "^10.2",
+ "phpunit/phpunit": "^12.4",
"nasqueron/codestyle": "^0.1.2"
},
"suggest": {
"keruald/omnitools": "Allows to fire database events"
},
"scripts": {
"lint-src": "find src -type f -name '*.php' | xargs -n1 php -l",
"lint-tests": "find tests -type f -name '*.php' | xargs -n1 php -l",
"test": "vendor/bin/phpunit"
},
"license": "BSD-2-Clause",
"autoload": {
"psr-4": {
"Keruald\\Database\\": "src/",
"Keruald\\Database\\Tests\\": "tests/"
}
}
}
diff --git a/github/composer.json b/github/composer.json
index 81331d9..118aef6 100644
--- a/github/composer.json
+++ b/github/composer.json
@@ -1,41 +1,41 @@
{
"name": "keruald/github",
"description": "X-Hub-Signature generator and validator",
"license": "BSD-2-Clause",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/keruald/github"
}
],
"authors": [
{
"name": "Sébastien Santoro",
"email": "dereckson@espace-win.org"
}
],
"keywords": [
"keruald",
"GitHub"
],
"support": {
"irc": "irc://irc.libera.chat/nasqueron",
"issues": "https://devcentral.nasqueron.org"
},
"require": {
"php": ">=5.6.0"
},
"require-dev": {
"php": ">=8.2.0",
- "phpunit/phpunit": "11.*"
+ "phpunit/phpunit": "^12.4"
},
"autoload": {
"psr-4": {
"Keruald\\GitHub\\": "src/",
"Keruald\\GitHub\\Tests\\": "tests/"
}
},
"scripts": {
"test": "phpunit tests"
}
}
diff --git a/omnitools/composer.json b/omnitools/composer.json
index 293dbe3..f0497248 100644
--- a/omnitools/composer.json
+++ b/omnitools/composer.json
@@ -1,27 +1,27 @@
{
"name": "keruald/omnitools",
"description": "Utilities classes",
"type": "library",
"license": "BSD-2-Clause",
"authors": [
{
"name": "Sébastien Santoro",
"email": "dereckson@espace-win.org"
}
],
"autoload": {
"psr-4": {
"Keruald\\OmniTools\\": "src/",
"Keruald\\OmniTools\\Tests\\": "tests/"
}
},
"require": {
"ext-intl": "*"
},
"require-dev": {
"nasqueron/codestyle": "^0.1.2",
"phan/phan": "^5.3.1",
- "phpunit/phpunit": "^10.2",
+ "phpunit/phpunit": "^12.4",
"squizlabs/php_codesniffer": "^4.0.0"
}
}
diff --git a/omnitools/tests/HTTP/URLTest.php b/omnitools/tests/HTTP/URLTest.php
index f7fce5d..059916d 100644
--- a/omnitools/tests/HTTP/URLTest.php
+++ b/omnitools/tests/HTTP/URLTest.php
@@ -1,83 +1,83 @@
<?php
declare(strict_types=1);
namespace Keruald\OmniTools\Tests\HTTP;
use Keruald\OmniTools\HTTP\URL;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
class URLTest extends TestCase {
#[DataProvider('provideURLsAndComponents')]
- public function testGetDomain ($url, $expectedDomain) : void {
+ public function testGetDomain ($url, $expectedDomain, $_, $__, $___ = null) : void {
$url = new URL($url);
$this->assertEquals($expectedDomain, $url->getDomain());
}
#[DataProvider('provideURLsAndComponents')]
- public function testGetProtocol ($url, $_, $expectedProtocol) : void {
+ public function testGetProtocol ($url, $_, $expectedProtocol, $__, $___ = null) : void {
$url = new URL($url);
$this->assertEquals($expectedProtocol, $url->getProtocol());
}
#[DataProvider('provideURLsAndComponents')]
- public function testGetQuery ($url, $_, $__, $expectedQuery) : void {
+ public function testGetQuery ($url, $_, $__, $expectedQuery, $___ = null) : void {
$url = new URL($url);
$this->assertEquals($expectedQuery, $url->getQuery());
}
public function testSetProtocol () : void {
$url = new URL("https://acme.tld/foo");
$url->setProtocol("xizzy");
$this->assertEquals("xizzy", $url->getProtocol());
}
public function testSetDomain () : void {
$url = new URL("https://acme.tld/foo");
$url->setDomain("xizzy");
$this->assertEquals("xizzy", $url->getDomain());
}
public function testSetQuery () : void {
$url = new URL("https://acme.tld/foo");
$url->setQuery("/xizzy");
$this->assertEquals("/xizzy", $url->getQuery());
}
public function testSetQueryWithSlashForgotten () : void {
$url = new URL("https://acme.tld/foo");
$url->setQuery("xizzy");
$this->assertEquals("/xizzy", $url->getQuery());
}
#[DataProvider('provideURLsAndComponents')]
public function testCompose ($url, $domain, $protocol, $query,
$expectedUrl = null) {
$this->assertEquals(
$expectedUrl ?? $url,
URL::compose($protocol, $domain, $query)->__toString()
);
}
public static function provideURLsAndComponents () : iterable {
// base URL, domain, protocol, query[, expected URL]
// When omitted, the expected URL is the base URL.
yield ["http://foo/bar", "foo", "http", "/bar"];
yield ["https://xn--dghrefn-mxa.nasqueron.org/", "dæghrefn.nasqueron.org", "https", "/"];
yield ["://foo/bar", "foo", "", "/bar"];
yield ["/bar", "", "", "/bar"];
yield ["http://foo/bar%20quux", "foo", "http", "/bar quux"];
yield ["https://foo/", "foo", "https", "/"];
yield ["https://foo", "foo", "https", "/", "https://foo/"];
}
}
diff --git a/omnitools/tests/Strings/Multibyte/StringUtilitiesTest.php b/omnitools/tests/Strings/Multibyte/StringUtilitiesTest.php
index 77c8092..3885b83 100644
--- a/omnitools/tests/Strings/Multibyte/StringUtilitiesTest.php
+++ b/omnitools/tests/Strings/Multibyte/StringUtilitiesTest.php
@@ -1,116 +1,118 @@
<?php
declare(strict_types=1);
namespace Keruald\OmniTools\Tests\Strings\Multibyte;
use Keruald\OmniTools\Strings\Multibyte\StringUtilities;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
class StringUtilitiesTest extends TestCase {
///
/// Tests
///
#[DataProvider('providePadding')]
public function testPad (
string $expected,
string $input, int $padLength, string $padString, int $padType
) : void {
$paddedString = StringUtilities::pad(
$input, $padLength, $padString, $padType, "UTF-8"
);
$this->assertEquals($expected, $paddedString);
}
public function testPadWithDefaultArguments () : void {
$this->assertEquals("foo ", StringUtilities::pad("foo", 4));
$this->assertEquals("foo_", StringUtilities::pad("foo", 4, '_'));
$this->assertEquals("_foo", StringUtilities::pad("foo", 4, '_', STR_PAD_LEFT));
}
public function testSupportedEncoding () : void {
$this->assertTrue(StringUtilities::isSupportedEncoding("UTF-8"));
$this->assertFalse(StringUtilities::isSupportedEncoding("notexisting"));
}
public function testStartsWith () : void {
$this->assertTrue(StringUtilities::startsWith("foo", "fo"));
$this->assertTrue(StringUtilities::startsWith("foo", ""));
$this->assertTrue(StringUtilities::startsWith("foo", "foo"));
$this->assertFalse(StringUtilities::startsWith("foo", "bar"));
}
public function testEndsWith () : void {
$this->assertTrue(StringUtilities::endsWith("foo", "oo"));
$this->assertTrue(StringUtilities::endsWith("foo", ""));
$this->assertTrue(StringUtilities::endsWith("foo", "foo"));
$this->assertFalse(StringUtilities::endsWith("foo", "oO"));
$this->assertFalse(StringUtilities::endsWith("foo", "bar"));
}
#[DataProvider('provideBase64')]
public function testEncodeInBase64 (string $decoded, string $encoded) : void {
$actual = StringUtilities::encodeInBase64($decoded);
$this->assertEquals($encoded, $actual);
}
#[DataProvider('provideBase64')]
public function testDecodeFromBase64 (string $decoded, string $encoded) : void {
$actual = StringUtilities::decodeFromBase64($encoded);
$this->assertEquals($decoded, $actual);
}
///
/// Data providers
///
public static function providePadding () : iterable {
// Tests from http://3v4l.org/UnXTF
// http://web.archive.org/web/20150711100913/http://3v4l.org/UnXTF
yield ['àèòàFOOàèòà', "FOO", 11, "àèò", STR_PAD_BOTH];
yield ['àèòFOOàèòà', "FOO", 10, "àèò", STR_PAD_BOTH];
yield ['àèòBAAZàèòà', "BAAZ", 11, "àèò", STR_PAD_BOTH];
yield ['àèòBAAZàèò', "BAAZ", 10, "àèò", STR_PAD_BOTH];
yield ['FOOBAR', "FOOBAR", 6, "àèò", STR_PAD_BOTH];
yield ['FOOBAR', "FOOBAR", 1, "àèò", STR_PAD_BOTH];
yield ['FOOBAR', "FOOBAR", 0, "àèò", STR_PAD_BOTH];
yield ['FOOBAR', "FOOBAR", -10, "àèò", STR_PAD_BOTH];
yield ['àèòàèòàèFOO', "FOO", 11, "àèò", STR_PAD_LEFT];
yield ['àèòàèòàFOO', "FOO", 10, "àèò", STR_PAD_LEFT];
yield ['àèòàèòàBAAZ', "BAAZ", 11, "àèò", STR_PAD_LEFT];
yield ['àèòàèòBAAZ', "BAAZ", 10, "àèò", STR_PAD_LEFT];
yield ['FOOBAR', "FOOBAR", 6, "àèò", STR_PAD_LEFT];
yield ['FOOBAR', "FOOBAR", 1, "àèò", STR_PAD_LEFT];
yield ['FOOBAR', "FOOBAR", 0, "àèò", STR_PAD_LEFT];
yield ['FOOBAR', "FOOBAR", -10, "àèò", STR_PAD_LEFT];
yield ['FOOàèòàèòàè', "FOO", 11, "àèò", STR_PAD_RIGHT];
yield ['FOOàèòàèòà', "FOO", 10, "àèò", STR_PAD_RIGHT];
yield ['BAAZàèòàèòà', "BAAZ", 11, "àèò", STR_PAD_RIGHT];
yield ['BAAZàèòàèò', "BAAZ", 10, "àèò", STR_PAD_RIGHT];
yield ['FOOBAR', "FOOBAR", 6, "àèò", STR_PAD_RIGHT];
yield ['FOOBAR', "FOOBAR", 1, "àèò", STR_PAD_RIGHT];
yield ['FOOBAR', "FOOBAR", 0, "àèò", STR_PAD_RIGHT];
yield ['FOOBAR', "FOOBAR", -10, "àèò", STR_PAD_RIGHT];
}
public static function provideBase64 () : iterable {
- yield ['foo', 'Zm9v', "This is the regular base test without any exception."];
- yield ['', '', "An empty string should remain an empty string."];
- yield [
+ yield "This is the regular base test without any exception." => ['foo', 'Zm9v'];
+
+ yield "An empty string should remain an empty string." => ['', ''];
+
+ yield "No padding should be used." => [
"J'ai fait mes 60 prières par terre dans la poudrière.",
'SidhaSBmYWl0IG1lcyA2MCBwcmnDqHJlcyBwYXIgdGVycmUgZGFucyBsYSBwb3VkcmnDqHJlLg',
- "No padding should be used."
];
- yield [
- "àèòàFOOàèòà", "w6DDqMOyw6BGT0_DoMOow7LDoA",
- "Slashes / should be replaced by underscores _."
+
+ yield "Slashes / should be replaced by underscores _." => [
+ "àèòàFOOàèòà",
+ "w6DDqMOyw6BGT0_DoMOow7LDoA",
];
}
}
diff --git a/report/composer.json b/report/composer.json
index 704841f..c9b832c 100644
--- a/report/composer.json
+++ b/report/composer.json
@@ -1,18 +1,18 @@
{
"name": "keruald/report",
"description": "Build a report with sections and entries. Markdown, PHP objects and HTML outputs.",
"type": "library",
"require-dev": {
"nasqueron/codestyle": "^0.1.2",
"phan/phan": "^5.3",
- "phpunit/phpunit": "^10.2",
+ "phpunit/phpunit": "^12.4",
"squizlabs/php_codesniffer": "^4.0.0"
},
"license": "BSD-2-Clause",
"autoload": {
"psr-4": {
"Keruald\\Reporting\\": "src/",
"Keruald\\Reporting\\Tests\\": "tests/"
}
}
}
diff --git a/yaml/composer.json b/yaml/composer.json
index 707d4fd..2509e19 100644
--- a/yaml/composer.json
+++ b/yaml/composer.json
@@ -1,42 +1,42 @@
{
"name": "keruald/yaml",
"description": "YAML parser",
"license": "BSD-2-Clause",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/keruald/yaml"
}
],
"authors": [
{
"name": "Sébastien Santoro",
"email": "dereckson@espace-win.org"
}
],
"keywords": [
"keruald",
"YAML"
],
"support": {
"irc": "irc://irc.libera.chat/nasqueron",
"issues": "https://devcentral.nasqueron.org"
},
"require": {
"keruald/omnitools": "^0.16.0",
"symfony/yaml": "^7.3.5",
"php": ">=8.3.0"
},
"require-dev": {
- "phpunit/phpunit": "12.*"
+ "phpunit/phpunit": "^12.4"
},
"autoload": {
"psr-4": {
"Keruald\\Yaml\\": "src/",
"Keruald\\Yaml\\Tests\\": "tests/"
}
},
"scripts": {
"test": "phpunit tests"
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Mar 21, 07:03 (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3546600
Default Alt Text
(22 KB)
Attached To
Mode
rKERUALD Keruald libraries development repository
Attached
Detach File
Event Timeline
Log In to Comment