REDROOM
PHP 8.3.31
Path:
Logout
Edit File
Size: 3.01 KB
Close
/home/getspomw/royalsquad.us/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithRedis.php
Text
Base64
<?php namespace Illuminate\Foundation\Testing\Concerns; use Exception; use Illuminate\Foundation\Application; use Illuminate\Redis\RedisManager; use Illuminate\Support\Env; trait InteractsWithRedis { /** * Indicate connection failed if redis is not available. * * @var bool */ private static $connectionFailedOnceWithDefaultsSkip = false; /** * Redis manager instance. * * @var array<string, \Illuminate\Redis\RedisManager> */ private $redis; /** * Setup redis connection. * * @return void */ public function setUpRedis() { if (! extension_loaded('redis')) { $this->markTestSkipped('The redis extension is not installed. Please install the extension to enable '.__CLASS__); } if (static::$connectionFailedOnceWithDefaultsSkip) { $this->markTestSkipped('Trying default host/port failed, please set environment variable REDIS_HOST & REDIS_PORT to enable '.__CLASS__); } $app = $this->app ?? new Application; $host = Env::get('REDIS_HOST', '127.0.0.1'); $port = Env::get('REDIS_PORT', 6379); foreach (static::redisDriverProvider() as $driver) { $this->redis[$driver[0]] = new RedisManager($app, $driver[0], [ 'cluster' => false, 'options' => [ 'prefix' => 'test_', ], 'default' => [ 'host' => $host, 'port' => $port, 'database' => 5, 'timeout' => 0.5, 'name' => 'default', ], ]); } try { $this->redis['phpredis']->connection()->flushdb(); } catch (Exception) { if ($host === '127.0.0.1' && $port === 6379 && Env::get('REDIS_HOST') === null) { static::$connectionFailedOnceWithDefaultsSkip = true; $this->markTestSkipped('Trying default host/port failed, please set environment variable REDIS_HOST & REDIS_PORT to enable '.__CLASS__); } } } /** * Teardown redis connection. * * @return void */ public function tearDownRedis() { if (isset($this->redis['phpredis'])) { $this->redis['phpredis']->connection()->flushdb(); } foreach (static::redisDriverProvider() as $driver) { if (isset($this->redis[$driver[0]])) { $this->redis[$driver[0]]->connection()->disconnect(); } } } /** * Get redis driver provider. * * @return array */ public static function redisDriverProvider() { return [ ['predis'], ['phpredis'], ]; } /** * Run test if redis is available. * * @param callable $callback * @return void */ public function ifRedisAvailable($callback) { $this->setUpRedis(); $callback(); $this->tearDownRedis(); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 13
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
InteractsWithAuthentication.php
3.92 KB
lrw-rw-rw-
2025-09-17 06:52:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
InteractsWithConsole.php
2.08 KB
lrw-rw-rw-
2025-09-17 06:52:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
InteractsWithContainer.php
6.48 KB
lrw-rw-rw-
2025-09-17 06:52:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
InteractsWithDatabase.php
9.82 KB
lrw-rw-rw-
2025-09-17 06:52:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
InteractsWithDeprecationHandling.php
1.16 KB
lrw-rw-rw-
2025-09-17 06:52:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
InteractsWithExceptionHandling.php
6.65 KB
lrw-rw-rw-
2025-09-17 06:52:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
InteractsWithRedis.php
3.01 KB
lrw-rw-rw-
2025-09-17 06:52:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
InteractsWithSession.php
1.12 KB
lrw-rw-rw-
2025-09-17 06:52:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
InteractsWithTestCaseLifecycle.php
7.94 KB
lrw-rw-rw-
2025-09-17 06:52:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
InteractsWithTime.php
1.49 KB
lrw-rw-rw-
2025-09-17 06:52:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
InteractsWithViews.php
2.34 KB
lrw-rw-rw-
2025-09-17 06:52:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
MakesHttpRequests.php
20.02 KB
lrw-rw-rw-
2025-09-17 06:52:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
WithoutExceptionHandlingHandler.php
111 B
lrw-rw-rw-
2025-09-17 06:52:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).