Source of file FlushCacheTest.php
Size: 1,694 Bytes - Last Modified: 2021-12-24T06:51:36+00:00
/var/www/docs.ssmods.com/process/src/tests/Console/Command/FlushCacheTest.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 | <?php namespace Heystack\Core\Console\Command; use Heystack\Core\Console\Application; use Symfony\Component\Console\Tester\CommandTester; class FlushCacheTest extends \PHPUnit_Framework_TestCase { /** * @covers \Heystack\Core\Console\Command\FlushCache::execute * @covers \Heystack\Core\Console\Command\FlushCache::configure */ public function testCacheDidFlush() { $cache = $this->getMockBuilder('Doctrine\Common\Cache\CacheProvider') ->setMethods(['flushAll']) ->getMockForAbstractClass(); $cache->expects($this->once()) ->method('flushAll'); $command = new FlushCache(); $command->setCacheService($cache); $application = new Application(); $application->add($command); $application->find('flush-cache'); $commandTester = new CommandTester($command); $commandTester->execute(['command' => $command->getName()]); } /** * @covers \Heystack\Core\Console\Command\FlushCache::execute * @covers \Heystack\Core\Console\Command\FlushCache::configure */ public function testCacheDidntFlush() { $cache = $this->getMockBuilder('Doctrine\Common\Cache\CacheProvider') ->setMethods(['flushAll']) ->getMockForAbstractClass(); $cache->expects($this->never()) ->method('flushAll'); $command = new FlushCache(); $application = new Application(); $application->add($command); $application->find('flush-cache'); $commandTester = new CommandTester($command); $commandTester->execute(['command' => $command->getName()]); } } |