/** * @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()]); }
/** * @covers \Heystack\Core\Console\Command\GenerateContainer::__construct * @covers \Heystack\Core\Console\Command\GenerateContainer::execute * @covers \Heystack\Core\Console\Command\GenerateContainer::configure * @covers \Heystack\Core\Console\Command\GenerateContainer::createContainer * @covers \Heystack\Core\Console\Command\GenerateContainer::loadConfig * @covers \Heystack\Core\Console\Command\GenerateContainer::dumpContainer */ public function testContainerCreated() { $command = $this->getMock(__NAMESPACE__ . '\\GenerateContainer', ['getRealPath'], [vfsStream::url('root'), vfsStream::url('root/heystack')]); $command->expects($this->once())->method('getRealPath')->will($this->returnArgument(0)); $application = new Application(); $application->add($command); $application->find('generate-container'); $commandTester = new CommandTester($command); $commandTester->execute(['command' => $command->getName()]); $this->assertTrue($this->rootFileSystem->hasChild('heystack/cache/HeystackServiceContainerlive.php')); $this->assertContains('class HeystackServiceContainerlive extends Heystack\\Core\\DependencyInjection\\SilverStripe\\HeystackSilverStripeContainer', file_get_contents(vfsStream::url('root/heystack/cache/HeystackServiceContainerlive.php'))); }