File tree Expand file tree Collapse file tree 3 files changed +65
-1
lines changed
tests/Configuration/Cache Expand file tree Collapse file tree 3 files changed +65
-1
lines changed Original file line number Diff line number Diff line change 157
157
| Configure meta-data, query and result caching here.
158
158
| Optionally you can enable second level caching.
159
159
|
160
- | Available: apc|array|file|memcached|redis|void
160
+ | Available: apc|array|file|memcached|phpFile| redis|void
161
161
|
162
162
*/
163
163
'cache ' => [
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace LaravelDoctrine \ORM \Configuration \Cache ;
4
+
5
+ use Doctrine \Common \Cache \FilesystemCache ;
6
+ use Doctrine \Common \Cache \PhpFileCache ;
7
+ use Illuminate \Contracts \Config \Repository ;
8
+ use LaravelDoctrine \ORM \Configuration \Driver ;
9
+ use function storage_path ;
10
+
11
+ class PhpFileCacheProvider implements Driver
12
+ {
13
+ /**
14
+ * @var Repository
15
+ */
16
+ protected $ config ;
17
+
18
+ /**
19
+ * @param Repository $config
20
+ */
21
+ public function __construct (Repository $ config )
22
+ {
23
+ $ this ->config = $ config ;
24
+ }
25
+
26
+ /**
27
+ * @param array $settings
28
+ *
29
+ * @return PhpFileCache
30
+ */
31
+ public function resolve (array $ settings = [])
32
+ {
33
+ return new PhpFileCache (
34
+ $ this ->config ->get ('cache.stores.file.path ' , storage_path ('framework/cache ' ))
35
+ );
36
+ }
37
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ use Doctrine \Common \Cache \PhpFileCache ;
4
+ use Illuminate \Contracts \Config \Repository ;
5
+ use LaravelDoctrine \ORM \Configuration \Cache \PhpFileCacheProvider ;
6
+ use Mockery as m ;
7
+
8
+ class PhpFileCacheProviderTest extends AbstractCacheProviderTest
9
+ {
10
+ public function getProvider ()
11
+ {
12
+ $ config = m::mock (Repository::class);
13
+ $ config ->shouldReceive ('get ' )
14
+ ->with ('cache.stores.file.path ' , __DIR__ . DIRECTORY_SEPARATOR . '../../Stubs/storage/framework/cache ' )
15
+ ->once ()
16
+ ->andReturn ('/tmp ' );
17
+
18
+ return new PhpFileCacheProvider (
19
+ $ config
20
+ );
21
+ }
22
+
23
+ public function getExpectedInstance ()
24
+ {
25
+ return PhpFileCache::class;
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments