-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrine\ORM\Configuration\Cache; | ||
|
||
use Doctrine\Common\Cache\PhpFileCache; | ||
use Illuminate\Contracts\Config\Repository; | ||
use LaravelDoctrine\ORM\Configuration\Driver; | ||
use function storage_path; | ||
|
||
class PhpFileCacheProvider implements Driver | ||
{ | ||
/** | ||
* @var Repository | ||
*/ | ||
protected $config; | ||
|
||
/** | ||
* @param Repository $config | ||
*/ | ||
public function __construct(Repository $config) | ||
{ | ||
$this->config = $config; | ||
} | ||
|
||
/** | ||
* @param array $settings | ||
* | ||
* @return PhpFileCache | ||
*/ | ||
public function resolve(array $settings = []) | ||
{ | ||
return new PhpFileCache( | ||
$this->config->get('cache.stores.file.path', storage_path('framework/cache')) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
use Doctrine\Common\Cache\PhpFileCache; | ||
use Illuminate\Contracts\Config\Repository; | ||
use LaravelDoctrine\ORM\Configuration\Cache\PhpFileCacheProvider; | ||
use Mockery as m; | ||
|
||
class PhpFileCacheProviderTest extends AbstractCacheProviderTest | ||
{ | ||
public function getProvider() | ||
{ | ||
$config = m::mock(Repository::class); | ||
$config->shouldReceive('get') | ||
->with('cache.stores.file.path', __DIR__ . DIRECTORY_SEPARATOR . '../../Stubs/storage/framework/cache') | ||
->once() | ||
->andReturn('/tmp'); | ||
|
||
return new PhpFileCacheProvider( | ||
$config | ||
); | ||
} | ||
|
||
public function getExpectedInstance() | ||
{ | ||
return PhpFileCache::class; | ||
} | ||
} |