-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWorkTest.php
More file actions
56 lines (40 loc) · 1.22 KB
/
WorkTest.php
File metadata and controls
56 lines (40 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
declare(strict_types=1);
namespace App\Tests;
use App\Core\work;
use HyssaDev\HibikenAsynqClient\Client;
use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Facades\Facade;
use Illuminate\Redis\Connections\PhpRedisConnection;
use Lunaweb\RedisMock\Providers\RedisMockServiceProvider;
final class WorkTest extends AdminatorTestCase
{
public $app;
protected function setUp(): void
{
}
protected function tearDown(): void
{
}
public static function setDownAfterClass(): void
{
Facade::clearResolvedInstances();
}
public function testRedisConnectionInstance()
{
$this->assertInstanceOf(PhpRedisConnection::class, Redis::connection());
}
public function testTaskEnqueue()
{
$container = self::initDIcontainer(true, false);
$adminatorMock = self::initAdminatorMockClass($container);
$this->assertIsObject($adminatorMock);
$work = new work($container);
$this->assertInstanceOf(Work::class, $work);
$faker = \Faker\Factory::create();
for ($i = 0; $i < 250; $i++) {
[$rs, $task] = $work->taskEnqueue($faker->numberBetween(1, 30));
$this->assertTrue($task);
}
}
}