You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To run your application tests without a real Redis server, you may swap the underlying repository to an array.
687
+
688
+
This will allow you to test with your models without needing to interact with Redis:
689
+
690
+
```php
691
+
use DirectoryTree\ActiveRedis\Model;
692
+
693
+
Model::setRepository('array');
694
+
```
695
+
696
+
Otherwise, you will need to run your tests with a Redis server running, and flush your Redis database after each test:
697
+
698
+
```php
699
+
use Illuminate\Support\Facades\Redis;
700
+
701
+
// Pest
702
+
beforeEach(fn () => Redis::flushdb());
703
+
704
+
// PHPUnit
705
+
protected function setUp(): void
706
+
{
707
+
parent::setUp();
708
+
709
+
Redis::flushdb();
710
+
}
711
+
```
712
+
683
713
## Credits
684
714
685
715
This package is directly inspired from <ahref="https://laravel.com/docs/eloquent">Laravel's Eloquent</a>, and most features are direct ports to a Redis equivalent.
0 commit comments