mirror of
https://github.com/danog/AsyncOrm.git
synced 2024-11-26 12:24:59 +01:00
Improve tests
This commit is contained in:
parent
be9b7e1039
commit
b6bacba615
@ -101,7 +101,6 @@ final class MysqlArray extends SqlArray
|
||||
if (!\extension_loaded('pdo_mysql')) {
|
||||
throw new AssertionError("PDO is needed for the mysql backend!");
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
$pdo = new PDO(
|
||||
$host[0] === '/'
|
||||
@ -110,6 +109,7 @@ final class MysqlArray extends SqlArray
|
||||
$settings->config->getUser(),
|
||||
$settings->config->getPassword(),
|
||||
);
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
self::$connections[$dbKey] = [
|
||||
new MysqlConnectionPool($settings->config, $settings->maxConnections, $settings->idleTimeout),
|
||||
|
@ -163,8 +163,10 @@ final class RedisArray extends DriverArray
|
||||
foreach ($request as $key) {
|
||||
$keys[] = $key;
|
||||
if (\count($keys) === 10) {
|
||||
// @codeCoverageIgnoreStart
|
||||
$this->db->delete(...$keys);
|
||||
$keys = [];
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
}
|
||||
if ($keys) {
|
||||
|
@ -50,6 +50,7 @@ use danog\AsyncOrm\ValueType;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use ReflectionProperty;
|
||||
use Revolt\EventLoop;
|
||||
use WeakReference;
|
||||
|
||||
use function Amp\async;
|
||||
@ -561,6 +562,12 @@ final class OrmTest extends TestCase
|
||||
$f2 = async($orm->get(...), $key);
|
||||
$this->assertSame($value, $f1->await());
|
||||
$this->assertSame($value, $f2->await());
|
||||
|
||||
$orm[$key] = PHP_INT_MAX;
|
||||
$this->assertSame(PHP_INT_MAX, $orm[$key]);
|
||||
EventLoop::queue($orm->set(...), $key, $value);
|
||||
$c->flushCache();
|
||||
$this->assertSame($value, $orm[$key]);
|
||||
}
|
||||
|
||||
$orm->clear();
|
||||
|
Loading…
Reference in New Issue
Block a user