addPool() public method

public addPool ( Psr\Cache\CacheItemPoolInterface $pool )
$pool Psr\Cache\CacheItemPoolInterface
Example #1
0
    /**
     * @group legacy
     * @expectedDeprecation The Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer::addPool() method is deprecated since version 3.3 and will be removed in 4.0. Pass an array of pools indexed by name to the constructor instead.
     */
    public function testClearPoolsInjectedByAdder()
    {
        $pool1 = $this->getMockBuilder(CacheItemPoolInterface::class)->getMock();
        $pool1
            ->expects($this->once())
            ->method('clear');

        $pool2 = $this->getMockBuilder(CacheItemPoolInterface::class)->getMock();
        $pool2
            ->expects($this->once())
            ->method('clear');

        $clearer = new Psr6CacheClearer(array('pool1' => $pool1));
        $clearer->addPool($pool2);
        $clearer->clear('');
    }