Skip to content

Commit

Permalink
test: fix TypeError
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Dec 17, 2023
1 parent f08e5ed commit 5aaf030
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/RedisHandlerTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Tests;

use CodeIgniter\I18n\Time;
Expand Down Expand Up @@ -112,7 +114,7 @@ public function testPop()
$redis = self::getPrivateProperty($handler, 'redis');
$this->assertSame(1_234_567_890_654_321, $result->id);
$this->assertSame(0, $redis->zCard('queues:queue1:default'));
$this->assertTrue($redis->hExists('queues:queue1::reserved', $result->id));
$this->assertTrue($redis->hExists('queues:queue1::reserved', (string) $result->id));
}

public function testPopEmpty()
Expand All @@ -129,13 +131,13 @@ public function testLater()
$queueJob = $handler->pop('queue1', ['default']);

$redis = self::getPrivateProperty($handler, 'redis');
$this->assertTrue($redis->hExists('queues:queue1::reserved', $queueJob->id));
$this->assertTrue($redis->hExists('queues:queue1::reserved', (string) $queueJob->id));
$this->assertSame(0, $redis->zCard('queues:queue1:default'));

$result = $handler->later($queueJob, 60);

$this->assertTrue($result);
$this->assertFalse($redis->hExists('queues:queue1::reserved', $queueJob->id));
$this->assertFalse($redis->hExists('queues:queue1::reserved', (string) $queueJob->id));
$this->assertSame(1, $redis->zCard('queues:queue1:default'));
}

Expand All @@ -150,7 +152,7 @@ public function testFailedAndKeepJob()
$redis = self::getPrivateProperty($handler, 'redis');

$this->assertTrue($result);
$this->assertFalse($redis->hExists('queues:queue1::reserved', $queueJob->id));
$this->assertFalse($redis->hExists('queues:queue1::reserved', (string) $queueJob->id));
$this->assertSame(0, $redis->zCard('queues:queue1:default'));

$this->seeInDatabase('queue_jobs_failed', [
Expand All @@ -171,7 +173,7 @@ public function testFailedAndDontKeepJob()
$redis = self::getPrivateProperty($handler, 'redis');

$this->assertTrue($result);
$this->assertFalse($redis->hExists('queues:queue1::reserved', $queueJob->id));
$this->assertFalse($redis->hExists('queues:queue1::reserved', (string) $queueJob->id));
$this->assertSame(0, $redis->zCard('queues:queue1:default'));

$this->dontSeeInDatabase('queue_jobs_failed', [
Expand All @@ -191,7 +193,7 @@ public function testDoneAndKeepJob()
$redis = self::getPrivateProperty($handler, 'redis');

$this->assertTrue($result);
$this->assertFalse($redis->hExists('queues:queue1::reserved', $queueJob->id));
$this->assertFalse($redis->hExists('queues:queue1::reserved', (string) $queueJob->id));
$this->assertSame(1, $redis->lLen('queues:queue1::done'));
}

Expand All @@ -206,7 +208,7 @@ public function testDoneAndDontKeepJob()
$result = $handler->done($queueJob, false);

$this->assertTrue($result);
$this->assertFalse($redis->hExists('queues:queue1::reserved', $queueJob->id));
$this->assertFalse($redis->hExists('queues:queue1::reserved', (string) $queueJob->id));
$this->assertSame(0, $redis->lLen('queues:queue1::done'));
}

Expand Down

0 comments on commit 5aaf030

Please sign in to comment.