vendor/league/flysystem-cached-adapter/spec/CachedAdapterSpec.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace spec\League\Flysystem\Cached;

use League\Flysystem\AdapterInterface;
use League\Flysystem\Cached\CacheInterface;
use League\Flysystem\Config;
use PhpSpec\ObjectBehavior;

class CachedAdapterSpec extends ObjectBehavior
{
    /**
     * @var AdapterInterface
     */
    private $adapter;

    /**
     * @var CacheInterface
     */
    private $cache;

    public function let(AdapterInterface $adapter, CacheInterface $cache)
    {
        $this->adapter = $adapter;
        $this->cache = $cache;
        $this->cache->load()->shouldBeCalled();
        $this->beConstructedWith($adapter, $cache);
    }

    public function it_is_initializable()
    {
        $this->shouldHaveType('League\Flysystem\Cached\CachedAdapter');
        $this->shouldHaveType('League\Flysystem\AdapterInterface');
    }

    public function it_should_forward_read_streams()
    {
        $path = 'path.txt';
        $response = ['path' => $path];
        $this->adapter->readStream($path)->willReturn($response);
        $this->readStream($path)->shouldbe($response);
    }

    public function it_should_cache_writes()
    {
        $type = 'file';
        $path = 'path.txt';
        $contents = 'contents';
        $config = new Config();
        $response = compact('path', 'contents', 'type');
        $this->adapter->write($path, $contents, $config)->willReturn($response);
        $this->cache->updateObject($path, $response, true)->shouldBeCalled();
        $this->write($path, $contents, $config)->shouldBe($response);
    }

    public function it_should_cache_streamed_writes()
    {
        $type = 'file';
        $path = 'path.txt';
        $stream = tmpfile();

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。