|
6 | 6 |
|
7 | 7 | describe(StoreManager::class, function () { |
8 | 8 | it('creates a file-based MessageStore when driver=file', function () { |
9 | | - config(['mailbox-for-laravel.storage_driver' => 'file']); |
| 9 | + config(['inbox.store.driver' => 'file']); |
10 | 10 |
|
11 | 11 | $store = (new StoreManager)->create(); |
12 | 12 |
|
13 | 13 | expect($store)->toBeInstanceOf(FileStorage::class); |
14 | 14 | }); |
15 | 15 |
|
16 | 16 | it('throws when an unknown driver is configured', function () { |
17 | | - config(['mailbox-for-laravel.storage_driver' => 'foo']); |
| 17 | + config(['inbox.store.driver' => 'foo']); |
18 | 18 |
|
19 | 19 | expect(fn () => (new StoreManager)->create()) |
20 | 20 | ->toThrow(InvalidArgumentException::class); |
@@ -45,29 +45,45 @@ public function delete(string $key): void |
45 | 45 | unset($this->stored[$key]); |
46 | 46 | } |
47 | 47 |
|
| 48 | + public function update(string $key, array $value): ?array |
| 49 | + { |
| 50 | + if (! isset($this->stored[$key])) { |
| 51 | + return null; |
| 52 | + } |
| 53 | + $this->stored[$key] = array_merge($this->stored[$key], $value); |
| 54 | + |
| 55 | + return $this->stored[$key]; |
| 56 | + } |
| 57 | + |
48 | 58 | public function purgeOlderThan(int $seconds): void |
49 | 59 | { |
50 | 60 | $this->stored = []; |
51 | 61 | } |
| 62 | + |
| 63 | + public function clear(): bool |
| 64 | + { |
| 65 | + $this->stored = []; |
| 66 | + |
| 67 | + return true; |
| 68 | + } |
52 | 69 | }; |
53 | 70 |
|
54 | | - config([ |
55 | | - 'mailbox-for-laravel.storage_driver' => 'memory', |
56 | | - 'mailbox-for-laravel.storage_resolvers' => [ |
57 | | - 'memory' => fn () => $custom, |
58 | | - ], |
| 71 | + Config::set('inbox.store.driver', 'memory'); |
| 72 | + Config::set('inbox.store.resolvers', [ |
| 73 | + 'memory' => fn () => $custom, |
59 | 74 | ]); |
60 | 75 |
|
61 | 76 | $store = (new StoreManager)->create(); |
| 77 | + |
62 | 78 | expect($store)->toBe($custom); |
63 | 79 | }); |
64 | 80 |
|
65 | 81 | it('passes configuration options to store implementations', function () { |
66 | 82 | $tmp = sys_get_temp_dir().'/mailbox-tests'; |
67 | 83 | @mkdir($tmp, 0777, true); |
68 | 84 | config([ |
69 | | - 'mailbox-for-laravel.storage_driver' => 'file', |
70 | | - 'mailbox-for-laravel.storage' => ['path' => $tmp], |
| 85 | + 'inbox.store.driver' => 'file', |
| 86 | + 'inbox.store.file' => ['path' => $tmp], |
71 | 87 | ]); |
72 | 88 |
|
73 | 89 | $store = (new StoreManager)->create(); |
|
0 commit comments