PHP 5.5+ and replaced doctrine/cache with symfony/cache

This commit is contained in:
Pascal Baljet 2021-12-20 10:46:53 +01:00
commit 7eace8852a
12 changed files with 142 additions and 127 deletions

View file

@ -2,8 +2,9 @@
namespace Tests\FFMpeg\Unit\FFProbe;
use Tests\FFMpeg\Unit\TestCase;
use FFMpeg\FFProbe\OptionsTester;
use Symfony\Component\Cache\CacheItem;
use Tests\FFMpeg\Unit\TestCase;
class OptionsTesterTest extends TestCase
{
@ -36,11 +37,12 @@ class OptionsTesterTest extends TestCase
{
$cache = $this->getCacheMock();
$cache->expects($this->never())
->method('fetch');
$cache->expects($this->exactly(2))
->method('getItem')
->will($this->returnValue(new CacheItem));
$cache->expects($this->exactly(2))
->method('contains')
->method('hasItem')
->will($this->returnValue(false));
$cache->expects($this->exactly(2))
@ -73,16 +75,22 @@ class OptionsTesterTest extends TestCase
{
$cache = $this->getCacheMock();
$cache->expects($this->once())
->method('fetch')
->will($this->returnValue($data));
$cacheItem = new CacheItem;
$cacheItem->set($data);
$cache->expects($this->exactly(2))
->method('contains')
->method('getItem')
->willReturnOnConsecutiveCalls(
$this->returnValue($cacheItem),
$this->returnValue(new CacheItem)
);
$cache->expects($this->exactly(2))
->method('hasItem')
->willReturnOnConsecutiveCalls(
$this->returnValue(false),
$this->returnValue(true));
$this->returnValue(true)
);
$cache->expects($this->once())
->method('save');
@ -101,14 +109,17 @@ class OptionsTesterTest extends TestCase
{
$cache = $this->getCacheMock();
$cache->expects($this->once())
->method('fetch')
->with('option-' . $optionName)
->will($this->returnValue($isPresent));
$cacheItem = new CacheItem();
$cacheItem->set($isPresent);
$cache->expects($this->once())
->method('contains')
->with('option-' . $optionName)
->method('getItem')
->with(md5('option-' . $optionName))
->will($this->returnValue($cacheItem));
$cache->expects($this->once())
->method('hasItem')
->with(md5('option-' . $optionName))
->will($this->returnValue(true));
$ffprobe = $this->getFFProbeDriverMock();