PHP 5.5+ and replaced doctrine/cache with symfony/cache
This commit is contained in:
parent
bb5cb190bd
commit
7eace8852a
12 changed files with 142 additions and 127 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@
|
|||
|
||||
namespace Tests\FFMpeg\Unit;
|
||||
|
||||
use FFMpeg\FFProbe;
|
||||
use Symfony\Component\Process\ExecutableFinder;
|
||||
use Alchemy\BinaryDriver\ConfigurationInterface;
|
||||
use Alchemy\BinaryDriver\Configuration;
|
||||
use Alchemy\BinaryDriver\ConfigurationInterface;
|
||||
use FFMpeg\FFProbe;
|
||||
use Symfony\Component\Cache\CacheItem;
|
||||
use Symfony\Component\Process\ExecutableFinder;
|
||||
|
||||
class FFProbeTest extends TestCase
|
||||
{
|
||||
|
|
@ -100,13 +101,14 @@ class FFProbeTest extends TestCase
|
|||
|
||||
$cache = $this->getCacheMock();
|
||||
$cache->expects($this->once())
|
||||
->method('contains')
|
||||
->method('hasItem')
|
||||
->will($this->returnValue(false));
|
||||
$cache->expects($this->never())
|
||||
->method('fetch');
|
||||
$cache->expects($this->once())
|
||||
->method('getItem')
|
||||
->will($this->returnValue(new CacheItem));
|
||||
$cache->expects($this->once())
|
||||
->method('save')
|
||||
->with($this->anything(), $output);
|
||||
->with($this->anything());
|
||||
|
||||
$driver = $this->getFFProbeDriverMock();
|
||||
$driver->expects($this->once())
|
||||
|
|
@ -160,10 +162,11 @@ class FFProbeTest extends TestCase
|
|||
|
||||
$cache = $this->getCacheMock();
|
||||
$cache->expects($this->exactly(2))
|
||||
->method('contains')
|
||||
->method('hasItem')
|
||||
->will($this->returnValue(false));
|
||||
$cache->expects($this->never())
|
||||
->method('fetch');
|
||||
$cache->expects($this->once())
|
||||
->method('getItem')
|
||||
->will($this->returnValue(new CacheItem));
|
||||
|
||||
$driver = $this->getFFProbeDriverMock();
|
||||
$driver->expects($this->exactly(2))
|
||||
|
|
@ -205,13 +208,16 @@ class FFProbeTest extends TestCase
|
|||
|
||||
$tester = $this->getFFProbeOptionsTesterMock();
|
||||
|
||||
$cacheItem = new CacheItem;
|
||||
$cacheItem->set($output);
|
||||
|
||||
$cache = $this->getCacheMock();
|
||||
$cache->expects($this->once())
|
||||
->method('contains')
|
||||
->method('hasItem')
|
||||
->will($this->returnValue(true));
|
||||
$cache->expects($this->once())
|
||||
->method('fetch')
|
||||
->will($this->returnValue($output));
|
||||
->method('getItem')
|
||||
->will($this->returnValue($cacheItem));
|
||||
$cache->expects($this->never())
|
||||
->method('save');
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class TestCase extends BaseTestCase
|
|||
|
||||
public function getCacheMock()
|
||||
{
|
||||
return $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock();
|
||||
return $this->getMockBuilder('Psr\Cache\CacheItemPoolInterface')->getMock();
|
||||
}
|
||||
|
||||
public function getTimeCodeMock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue