Test Secure
parent
d230dbeac1
commit
f85c6145dc
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
convertDeprecationsToExceptions="true"
|
||||
executionOrder="random"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd">
|
||||
<testsuites>
|
||||
<testsuite name="all">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<coverage>
|
||||
<include>
|
||||
<directory>src</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
</phpunit>
|
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Arokettu\Random\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Random\Engine\Secure;
|
||||
use Random\Randomizer;
|
||||
|
||||
class EngineSecureTest extends TestCase
|
||||
{
|
||||
public function testWorks(): void
|
||||
{
|
||||
$engine = new Secure();
|
||||
self::assertNotEmpty($engine->generate());
|
||||
$rnd = new Randomizer($engine);
|
||||
$int = $rnd->getInt(1, 1000);
|
||||
self::assertGreaterThanOrEqual(1, $int);
|
||||
self::assertLessThanOrEqual(1000, $int);
|
||||
}
|
||||
|
||||
public function testNonSerializable(): void
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
serialize(new Secure());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue