Page MenuHomeDevCentral

No OneTemporary

diff --git a/composer.json b/composer.json
index d1a7e58..a017944 100644
--- a/composer.json
+++ b/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.0.1",
- "phan/phan": "^2.4",
- "phpunit/phpunit": "^7.5",
- "squizlabs/php_codesniffer": "^3.5"
+ "phan/phan": "^5.3.1",
+ "phpunit/phpunit": "^9.5",
+ "squizlabs/php_codesniffer": "^3.6"
}
}
diff --git a/phpunit.xml b/phpunit.xml
index f124e5c..f5c1939 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,22 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
-<phpunit bootstrap="vendor/autoload.php"
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
+ bootstrap="vendor/autoload.php"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false">
<php>
<ini name="display_errors" value="On" />
<ini name="display_startup_errors" value="On" />
<ini name="error_reporting" value="On" />
</php>
<testsuites>
<testsuite name="Unit tests">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
- <filter>
- <whitelist processUncoveredFilesFromWhitelist="true">
+ <coverage processUncoveredFiles="true">
+ <include>
<directory suffix=".php">src/</directory>
- </whitelist>
- </filter>
+ </include>
+ </coverage>
</phpunit>
diff --git a/tests/Identifiers/RandomTest.php b/tests/Identifiers/RandomTest.php
index 7c1f8c2..38a858e 100644
--- a/tests/Identifiers/RandomTest.php
+++ b/tests/Identifiers/RandomTest.php
@@ -1,61 +1,61 @@
<?php
declare(strict_types=1);
namespace Keruald\OmniTools\Tests\Identifiers;
use Keruald\OmniTools\Identifiers\Random;
use Phpunit\Framework\TestCase;
class RandomTest extends TestCase {
///
/// Tests
///
public function testGenerateHexadecimalHash () : void {
$hash = Random::generateHexHash();
$this->assertEquals(
32, strlen($hash),
"$hash size must be 32 characters"
);
- $this->assertRegExp("/[0-9a-f]{32}/", $hash);
+ $this->assertMatchesRegularExpression("/[0-9a-f]{32}/", $hash);
}
public function testHexadecimalHashesAreUnique() : void {
$this->assertNotEquals(
Random::generateHexHash(),
Random::generateHexHash()
);
}
/**
* @dataProvider provideRandomStringFormats
*/
public function testRandomString($format, $re, $len) : void {
$string = Random::generateString($format);
$this->assertEquals($len, strlen($format));
- $this->assertRegExp($re, $string);
+ $this->assertMatchesRegularExpression($re, $string);
}
public function testGenerateIdentifier() : void {
$identifier = Random::generateIdentifier(20);
$this->assertEquals(27, strlen($identifier));
- $this->assertRegExp("/^[A-Z0-9\-_]*$/i", $identifier);
+ $this->assertMatchesRegularExpression("/^[A-Z0-9\-_]*$/i", $identifier);
}
///
/// Data providers
///
public function provideRandomStringFormats() : iterable {
yield ["AAA111", "/^[A-Z]{3}[0-9]{3}$/", 6];
yield ["AAA123", "/^[A-Z]{3}[0-9]{3}$/", 6];
yield ["ABC123", "/^[A-Z]{3}[0-9]{3}$/", 6];
yield ["", "/^$/", 0];
}
}
diff --git a/tests/Identifiers/UUIDTest.php b/tests/Identifiers/UUIDTest.php
index 28d62ba..5dd2175 100644
--- a/tests/Identifiers/UUIDTest.php
+++ b/tests/Identifiers/UUIDTest.php
@@ -1,49 +1,49 @@
<?php
declare(strict_types=1);
namespace Keruald\OmniTools\Tests\Identifiers;
use Keruald\OmniTools\Identifiers\UUID;
use Phpunit\Framework\TestCase;
class UUIDTest extends TestCase {
public function testUUIDv4 () : void {
$uuid = UUID::UUIDv4();
$this->assertEquals(
36, strlen($uuid),
"UUID size must be 36 characters."
);
$re = "/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/";
- $this->assertRegExp($re, $uuid);
+ $this->assertMatchesRegularExpression($re, $uuid);
}
public function testUUIDv4WithoutHyphens () : void {
$uuid = UUID::UUIDv4WithoutHyphens();
$this->assertEquals(
32, strlen($uuid),
"UUID size must be 36 characters, and there are 4 hyphens, so here 32 characters are expected."
);
$re = "/[0-9a-f]/";
- $this->assertRegExp($re, $uuid);
+ $this->assertMatchesRegularExpression($re, $uuid);
}
public function testUUIDv4AreUnique () : void {
$this->assertNotEquals(UUID::UUIDv4(), UUID::UUIDv4());
}
public function testIsUUID () : void {
$this->assertTrue(UUID::isUUID("e14d5045-4959-11e8-a2e6-0007cb03f249"));
$this->assertFalse(
UUID::isUUID("e14d5045-4959-11e8-a2e6-0007cb03f249c"),
"The method shouldn't allow arbitrary size strings."
);
$this->assertFalse(UUID::isUUID("d825a90a27e7f161a07161c3a37dce8e"));
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Nov 24, 18:46 (2 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2258692
Default Alt Text
(5 KB)

Event Timeline